我坚持的简单问题:
我正在进行Wordpress安装,并添加了一些mod_rewrite
规则来解决一些漂亮的网址和暂存内容。它很有用,很棒。
当我将规则分离到自己的模块中以避免WP系统在永久链接上进行覆盖更改时,它们会停止工作。我不明白的语法错误?
这有效:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# BEGIN My additions
# Nice URLs
RewriteRule ^assets/(.*) /wp-content/themes/cool-theme/assets/$1 [QSA,L]
RewriteRule ^plugins/(.*) /wp-content/plugins/$1 [QSA,L]
# Staging media
RewriteRule ^media/(.*) http://coolsite.com/media/$1 [P]
# END My additions
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
这不是:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# BEGIN Cool Theme
<IfModule mod_rewrite.c>
RewriteRule ^assets/(.*) /wp-content/themes/cool-theme/assets/$1 [QSA,L]
RewriteRule ^plugins/(.*) /wp-content/plugins/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
</IfModule>
# END Cool Theme
# BEGIN Cool Site Staging
<IfModule mod_rewrite.c>
RewriteRule ^media/(.*) http://coolsite.com/media/$1 [P]
RewriteCond %{REQUEST_FILENAME} !-f
</IfModule>
# END Cool Site Staging