[英]http 301 redirect from htaccess to domain host
我在.htaccess文件中包含以下内容
redirect 301 /page.php http://domain.com/page
哪个工作正常且符合预期。
我希望能够重定向以下内容
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
所以基本上无论域名是什么,我都想重定向到它。 但是要注意的是我想使用301重定向。 这甚至可能吗? 或者我应该使用RewriteCond和RewriteRule吗?
我认为只要RewriteRule就足够了:
RewriteRule ^/page\.php$ /page [R=301,L]
这将导致对page.php
任何请求都被重定向到同一域上的page
。 R=301
导致使用301重定向。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.