简体   繁体   中英

mod_rewrite rules definition

i have a Problem with my .htaccess/mod_rewrite:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^sometest/(.+)/page/([0-9]+)$ index.php?main=sometest/$1&page=$2
RewriteRule ^(.+)$ index.php?main=$1 [QSA]

This does not work. If i visit my website the css files are not included. I include them like "/assets/css/blabla.css".

If i delete just one RewriteRule (doesn't matter which one) it works. But i need both rules.

You must use skip flag skip|S=num for this.

like :

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d  [NC,OR]
RewriteCond %{REQUEST_FILENAME} !-f  [NC]
RewriteCond %{REQUEST_URI} ^(.*)/([^/]+)\.([^/]+)$ 
RewriteRule ^ - [S=2,L]
RewriteRule ^sometest/(.+)/page/([0-9]+)$ index.php?main=sometest/$1&page=$2 [S=1,L]
RewriteRule ^(.+)$ index.php?main=$1 [QSA,L]

see this page for more information http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM