I recently found an article online that told me about this:
RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1§ion=$2 [NC]
Only thing that is driving me crazy right now is if I want to be able to have the 2nd directory or not. Like:
RewriteRule 开发者_JAVA技巧^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1§ion=$2 [NC]
RewriteRule ^mock-up/([^/]+) /mock-up/index.php?page=$1 [NC]
But that's breaking apache... so what to do? Please help, I need to seo for my client and I would prefer not to have to make individual files for this.
The problem is that mock-up/index.php
is also matched by mock-up/([^/]+)
. So you need to exclude the target, either directly:
RewriteRule ^mock-up/index\.php$ - [L]
Or indirectly:
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
So try this:
RewriteRule ^mock-up/index\.php$ - [L]
RewriteRule ^mock-up/([^/]+)/([^/]+)$ /mock-up/index.php?page=$1§ion=$2 [NC]
RewriteRule ^mock-up/([^/]+)$ /mock-up/index.php?page=$1 [NC]
精彩评论