I have the following in a .htaccess file
redirect 301 /page.php http://domain.com/page
Which works fine and as expected.
I want to be able to redirect the following
http://domain2.com/page.php to http://domain2.com/page
or
http://domain3.com/page.php to http://domain3.com/page
or
http://domain4.com/page.php to http://domain4.com/page
So basically whatever the domain name is, I want to r开发者_StackOverflow社区edirect to it. But the catch is I want to use a 301 redirect. Is this even possible ? Or should I be using RewriteCond and RewriteRule ?
I think just RewriteRule would be sufficient:
RewriteRule ^/page\.php$ /page [R=301,L]
This will cause any request for page.php
to be redirected to page
on the same domain. The R=301
causes a 301 redirect to be used.
精彩评论