Page 1 of 1

Redirecting, but keeping the url the same

Posted: Tue Oct 31, 2006 2:47 pm
by Luke
I didn't know where to post this because I'm not even sure if it's possible, but if so I'm betting it has something to do with apache...

Is it possible to make it so that if somebody types in http://www.mysite.com/cottages, it will redirect them to http://www.mysite.com/houses but keep the http://www.mysite.com/cottages in the url?

Posted: Tue Oct 31, 2006 3:07 pm
by volka

Posted: Tue Oct 31, 2006 3:11 pm
by RobertGonzalez
+1... mod_rewrite is the way to go.

Posted: Tue Oct 31, 2006 3:27 pm
by Luke
oh yea... I was thinking that mod_rewrite would change the url... but I guess I hadn't thought real hard about it... thanks.

Posted: Wed Nov 01, 2006 1:06 pm
by Luke
I am using these rules.. if I type in mysite.com/cottages/somepage.php, it drops me on mysite.com/accomodations/somepage.php and doesn't change the url, but if I type in mysite.com/cottages it redirects me to mysite.com/accomodations and it shows accomodations in the url... how come??

Code: Select all

RewriteEngine On

RewriteCond %{REQUEST_URI} ^/cottages$ [NC]
RewriteRule (.*) /accomodations [L]

RewriteCond %{REQUEST_URI} ^/cottages/(.*) [NC]
RewriteRule (.*) /accomodations/%1 [L]