更改wp-内容而不更改文件夹名称

时间:2015-07-19 作者:Moustafa

This does not work

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteRule ^/index\\.php$ - [L]
RewriteRule ^/css/(.*) /wp-content/themes/themename/css/$1 [QSA,L]
RewriteRule ^/js/(.*) /wp-content/themes/themename/js/$1 [QSA,L]
RewriteRule ^/img/(.*) /wp-content/themes/themename/img/$1 [QSA,L]
RewriteRule ^/font/(.*) /wp-content/themes/themename/font/$1 [QSA,L]
RewriteRule ^/plugins/(.*) /wp-content/plugins/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
1 个回复
最合适的回答,由SO网友:Adam 整理而成

从规则中删除前面的前斜杠:

示例(不正确)

RewriteRule ^/css/(.*) /wp-content/themes/themename/css/$1 [QSA,L]
示例(正确)

RewriteRule ^css/(.*) wp-content/themes/themename/css/$1 [QSA,L]
所有规则(正确)

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteRule ^/index\\.php$ - [L]
RewriteRule ^css/(.*) wp-content/themes/themename/css/$1 [QSA,L]
RewriteRule ^js/(.*) wp-content/themes/themename/js/$1 [QSA,L]
RewriteRule ^img/(.*) wp-content/themes/themename/img/$1 [QSA,L]
RewriteRule ^font/(.*) wp-content/themes/themename/font/$1 [QSA,L]
RewriteRule ^plugins/(.*) wp-content/plugins/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

结束

相关推荐

如何保护htaccess,使其不会被覆盖?

我遇到了一个问题,Wordpress会定期随机销毁.htaccess 并将其设置为零字节。当它这样做时,站点当然会中断,直到手动刷新永久链接.htaccess 已重写。如何保护.htaccess 文件完全(完全只读)或以其他方式防止Wordpress自动覆盖它?我的FTP客户端不允许我将权限设置为低于644,因此我无法将其设置为只读。