Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite dilemma

two websites, virtual directory and mod_rewrite

         

raman

7:54 am on Mar 23, 2011 (gmt 0)

10+ Year Member



Hi

I have two websites hosted on the same server website1.com and website2.com. Now, what i want is that all the users coming to website2.com/old should see what is on website1.com.

I don't want a browser redirect, I want them to see website2.com/old in the url and still see what's there on the website1.com.

website1.com is on /home/website1
website2.com is on /home/website2

To do this, I added an alias/virtual dir in httpd.conf and it's working. Now, I want the requests from website2.com/old/data to go to website1.com/data. And, I am not able to do that. My .htaccess on /home/website1 looks like this..


RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


Now, when I go to website2.com/old, it's working fine. but, when i go to website2.com/old/data, it's showing me the content of /home/website2/index.php ..

Please help. Thanks.

g1smd

8:37 am on Mar 23, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The "." captures all URL requests and the rule feeds them to the index.php script.

You'll need a URL pattern on the left which captures the requested URL path and then a server filepath and the $1 backreference on the right for actually fetching the content from that path.

raman

9:01 am on Mar 23, 2011 (gmt 0)

10+ Year Member



Thanks g1smd. But as i said.. it works. But, then .htaccess redirects www.website2.com/old/data to www.website2.com/index.php. But, i want it to be redirected to www.website1.com/index.php. How do i achieve that.

And I don't need a client redirect, so the url should still show www.website2.com/index.php.

jdMorgan

11:22 pm on Mar 28, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Since this is an internal rewrite rule, it is not responsible for your problem redirect. Look at your other rewriterules and redirection directives. Make sure the output of your rewriterule (above) won't match and trigger one of those redirection directives.

Jim