Domanda

I currently have this in my .htaccess:

RewriteEngine On

RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]

RewriteRule ^(.*),(.*)$ $2.php?rewrite_params=$1&page_url=$2

RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR] 
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR] 
RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR] 
RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2}) 
RewriteRule ^(.*)$ index.php [F,L]

I want to add some new code that rewrites:

stores/some-name/

to:

shop.php?shop_id=some-name

How can I do this without affecting the other rewrites or the other rewrites affecting the addition?

È stato utile?

Soluzione

You can add your new rule in the end:

RewriteEngine On

RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]

RewriteRule ^(.*),(.*)$ $2.php?rewrite_params=$1&page_url=$2 [L,QSA]

RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR] 
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR] 
RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR] 
RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2}) 
RewriteRule ^(.*)$ index.php [F,L]

RewriteRule ^stores/([0-9a-z.-]+)/?$ shop.php?shop_id=$1 [L,QSA,NC]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top