开发者

.htaccess, conflict in rules

I am just trying to understand how .htaccess work and what is right way of dealing with it and I have one problem. Here is part of my .htaccess file:

RewriteEngine on
RewriteRule ^(.*)/css/(.*)$ /css/$2
RewriteRule ^(.*)/img/(.*)$ /img/$2
RewriteRule ^(.*)/js/(.*)$ /js/$2

Everything is looks fine and have worked ok, t开发者_开发技巧ill I'll try to use TinyMCE that I have copied to js directory. It contain a lot of different subfolders, including img subfolders, and because of my rule RewriteRule ^(.*)/img/(.*)$ /img/$2 it doesn't work properly. I know that I can just rename folders in TinyMCE, but I think that I am not dealing with .htaccess in right way. Help me please.


Instead of matching any character in your rule, you can match one folder (allow every character except for /). That'll ensure that deep nested folders (e.g. modules/tinymce/js/) do not conflict with en/js/.

RewriteEngine on
RewriteRule ^([^/]*)/css/(.*)$ /css/$2
RewriteRule ^([^/]*)/img/(.*)$ /img/$2
RewriteRule ^([^/]*)/js/(.*)$ /js/$2
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜