PoorCadaver
PoorCadaver

Reputation: 73

SEO friendly redirect in .htaccess blocks subfolder

I have this code in my .htaccess to make my URLs SEO friendly and pretty:

RewriteRule ^([a-zA-Z0-9_-]+)/?$ index.php?page=$1 [L,QSA]

Now I notice that a subfolder (gallery.mysite.com ) set by my webhotel does no longer work. It gets redirected to index.php and seems to try to load an empty var (page).

Is there a way to force the subdomain not getting redirected?

I have tried this but it doesn't quite get there...

RewriteCond %{HTTP_HOST} ^gallery\.mysite\.com$ [NC]
RewriteRule ^((?!sub1/).*)$ sub1/$1 [L,NC]
RewriteCond %{HTTP_HOST} !^gallery\. [NC]

Upvotes: 1

Views: 99

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

You can use this

RewriteCond %{HTTP_HOST} !^gallery\.mysite\.com$
RewriteRule ^([a-zA-Z0-9_-]+)/?$ index.php?page=$1 [L,QSA]

Upvotes: 2

Related Questions