我有一个网站,其中包含一组已放入CMS的旧.html和.php网页。在.htaccess中使用mod_rewrite和mod_alias(重定向301)?
目前.htaccess文件中大约有30 mod_alias中重定向以下形式:
redirect 301 /oldpage1.html http://www.example.com/newpage1.php
redirect 301 /oldpage2.php http://www.example.com/newpage2.php
redirect 301 /oldpage3.php http://www.example.com/newpage3.php
但我们要使用mod_rewrite有漂亮的网址在CMS,将采取的形式http://www.example.com/pagename.php
,所以还具备以下条件:
RewriteEngine on
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1
在这两个被应用起来的那一刻,这会导致:
http://www.example.com/newpage1.php?page=oldpage1.html
如何申请只有当没有比赛已经由mod_alias中做出重定向301条语句,这样下发生的重写规则:
http://www.example.com/oldpage1.html
- >重定向到 - > http://www.example.com/newpage1.php
- 这被视为> - > http://www.example.com/index.php?page=/newpage1.php
任何提示将非常感激?谢谢。