Reputation: 33956
This is my rule:
RewriteRule ^([^/]+)(/.+)? /negocio$2.php?shopURL=$1 [L,QSA]
If $2
doesn't exist (URL doesn't have two slashes), I want to echo '/' instead of '.php'. So the condition becomes:
RewriteRule ^([^/]+)(/.+)? /negocio/?shopURL=$1 [L,QSA]
How do I do this or archive the same result?
Upvotes: 0
Views: 61
Reputation: 785146
Replace your code with this:
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^ - [L]
RewriteRule ^([^/]+)/?$ negocio/?shopURL=$1 [L,QSA]
RewriteRule ^([^/]+)(/.+?)/?$ negocio$2.php?shopURL=$1 [L,QSA]
Upvotes: 0
Reputation: 2224
Pretty sure this is what RewriteCond is for!
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/([^/]+)(/.+)$
RewriteRule ^([^/]+)(/.+)? /negocio$2.php?shopURL=$1 [L,QSA]
RewriteCond %{REQUEST_URI} ^/([^/]+)$
RewriteRule ^([^/]+)(/.+)? /negocio/?shopURL=$1 [L,QSA]
Upvotes: 1