开发者

having trouble with a mod_rewrite rule

开发者 https://www.devze.com 2022-12-25 02:27 出处:网络
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:

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

精彩评论

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