需要简单的Mod Rewrite .htaccess解决方案

时间:2014-06-27 15:06:20

标签: apache .htaccess mod-rewrite

为什么两个重写规则不能一起工作以及如何解决?

我正在尝试将wwww.mydomain.com/wordpress发送到wwww.mydomain.com/pages/wordpress.php

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^([a-z]+)(.*)$ /pages/$1.php [QSA,L]

谢谢,

1 个答案:

答案 0 :(得分:0)

您希望之前的新规则任何wordpress规则:

RewriteEngine On
RewriteBase /

RewriteRule ^([a-z]+)(.*)$ /pages/$1.php [QSA,L]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

wordpress规则将所有路由到index.php,包括您尝试匹配的任何内容。