想要将site.com/software
等网址重写为wp-content/themes/dir/software.php
,而某些内容无效......以下是我所拥有的内容:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^software wp-content/themes/dir/software.php [L]
谢谢!
答案 0 :(得分:0)
重写规则按遇到的顺序处理。在这种情况下,在遇到index.php
规则之前,每个请求都会被推送到software
(假设系统中不存在software
作为目录或文件)。第一条规则末尾的[L]
告诉Apache停止读取规则,因此它甚至不会处理下一条规则。
试试这个:
RewriteEngine On
RewriteBase /
RewriteRule ^software wp-content/themes/dir/software.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]