如何使用htaccess重定向几个静态页面并保持相同的URL?
示例:
Redirect www.mydomain.com/url-that-remains.php to www.mydomain.com/page-number-23
我当前的htaccess文件看起来像这样:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
答案 0 :(得分:1)
试试这个
RewriteEngine On
RewriteRule /somestaticpageonyourwebsite.html /yournewpage.html [R=302]
修改强>
我不知道为什么以上不起作用。这应该有用。
RedirectPermanent /somestaticpageonyourwebsite.html /yournewpage.html
答案 1 :(得分:1)
此代码应该有效:
RewriteEngine On
RewriteRule ^url-that-remains\.php$ /page-number-23 [L,NC]