Reputation: 314
What to skip the www in url - that works - here is the code I'm using
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,NC,L]
its working fine but : I would also like to jump to a subfolder ( without showing the subfolderName in url ) Is it possible to combine these 2 snippets ? cant get it to work.
other snippet :
RewriteEngine on
RewriteRule ^/$ /subfolder / [R]
please help - guess it is a simple answer for an mod-rewrite expert :)
cheers
Upvotes: 1
Views: 90
Reputation: 9548
Sure, you can combine them. This will just forward ever request to the root of subfolder:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,NC,L]
RewriteRule ^ subfolder [L]
Or you can do this if you want to shift the file requests over to the new directory:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,NC,L]
RewriteRule (.*) subfolder/$1 [L]
Upvotes: 1