mod_rewrite VS relative paths

前端 未结 5 2129
耶瑟儿~
耶瑟儿~ 2021-02-06 14:03

My mod_rewrite code is:

Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
Rewrite         


        
5条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-06 14:11

    you should always use absolute paths for images css etc, when playing with mod_rewrite but simple solution might be to ignore css,js, images and rest in RewriteRule ^(.+)?$ index.php?url=$1 [L,NC]

    RewriteRule ((js|css|images)\/.*)$ /$1 [L,NC]
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+)?$ index.php?url=$1 [L,NC]
    

    however this might not work if these dirs actually depend of the current url

提交回复
热议问题