Question

I have the follow .htaccess and it work good.

from http://us.domain.org/detail.php?id=1234 to http://us.domain.org/category/city/computer-1234

but if I add:

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^[^.]+\.domain\.org$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ /detail.php?id=$1 [L,QSA]

It does not work..How can I do?

Était-ce utile?

La solution

from http://us.domain.org/detail.php?id=1234 to http://us.domain.org/category/city/computer-1234

Change your last rule to:

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^[^.]+\.domain\.org$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/([^/-]+)-([^/]+)/?$ /detail.php?id=$4 [L,QSA]
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top