【发布时间】:2012-07-12 06:02:03
【问题描述】:
如何在没有 mod_alias 的 .htaccess 中为单个页面创建永久重定向 (301)?
f.e.
http://www.example.com/oldpage --> http://www.elpmaxe.com/newpage
【问题讨论】:
标签: apache .htaccess mod-rewrite redirect mod-alias
如何在没有 mod_alias 的 .htaccess 中为单个页面创建永久重定向 (301)?
f.e.
http://www.example.com/oldpage --> http://www.elpmaxe.com/newpage
【问题讨论】:
标签: apache .htaccess mod-rewrite redirect mod-alias
我的队友给了我很好的答案:
RewriteCond %{http_host} www\.example\.com$ [nc]
RewriteCond %{request_uri} ^/oldpage(/)?$ [nc]
RewriteRule ^(.*)$ http://www.elpmaxe.com/newpage [r=301,L,NC,NS,QSA]
【讨论】:
使用 mod_rewrite 和下面的 .htaccess
RewriteEngine on
RewriteRule ^oldpage/(.*)$ newpage/$1 [R=301]
【讨论】: