Forum Moderators: phranque
RewriteCond %{REQUEST_URI} !(\.|/$)
RewriteRule (.*) http://www\.example\.com/$1/ [R=301,L]
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^/?(.*)$ http://www\.example\.com/$1 [r=301,L]
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteRule ^(.*)$ http://www\.example\.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/(drupal|wordpress|joomla|dev|test|workingbackup) [NC]
RewriteRule ^.*$ - [L,S=2]
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteCond %{REQUEST_URI} ^/(.+) [NC]
RewriteRule ^(.*)$ ?/ [L]
RewriteRule ^(.*)$ joomla/$1 [L] [edited by: incrediBILL at 8:30 pm (utc) on Apr 25, 2012]
[edit reason] fixed links and exemplified domain [/edit]
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^/?(.*)$ http://www.example.com/$1 [r=301,L]
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
(also tried the version using {REQUEST_FILENAME} !-f och {REQUEST_FILENAME} !-d but without any success)
If a user types in a folder that is not listed in Rule 4,
ie a non-existing subfolder at the moment, instead of trying to go to this subfolder
I would like to rewrite to www.example.com, ie the root.
RewriteCond %{REQUEST_URI} ^/(drupal|wordpress|dev|test|workingbackup) [NC]
RewriteRule ^.*$ - [L]
But just out of curiosity is there a way to have an empty string as a substitute?
I.e. if I for some reason in the future want to replace a textstring with an empty string?