开发者

having trouble with a mod_rewrite rule

want to rewrite urls like site.com/software to wp-content/themes/dir/software.php and something is not working.. Here's what I have:

RewriteEngine O开发者_运维技巧n
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^software wp-content/themes/dir/software.php [L]

Thanks!


Rewrite rules are processed in the order that they are encountered. In this case, every request is getting pushed to index.php before your software rule is encountered (assuming that software doesn't exist in the system as a directory or file). The [L] on the end of the first rule tells Apache to stop reading rules, so it doesn't even bother processing the next one.

Try this:

RewriteEngine On
RewriteBase /
RewriteRule ^software wp-content/themes/dir/software.php [L]        
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜