I have joomla installed on root folder and another joomla installed on subfolder. I want to redirect www to non in subfolder by this code in blog htaccess: RewriteCond %{HTTP_HOST} ^(www\.mydomain\.com)?$ RewriteRule ^(.*)$ http://mydomain.com/blog/$2 [R=301,L] Code (markup): it worked for root redirect but when i want browse internal page it redirect the page to home page. What is problem?
I used this generator: http://www.scriptalicious.com/tools/www-redirect-generator/ and it returned: RewriteEngine On RewriteCond %{HTTP_HOST} ^www.domain.com/blog [NC] RewriteRule ^(.*)$ http://domain.com/blog/$1 [L,R=301] Code (markup):
You can have it like this: RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.(domain\.com)$ [NC] RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP_HOST} ^domain\.com$ RewriteCond %{REQUEST_URI} !^/subfolder/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /subfolder/$1 [L] RewriteCond %{HTTP_HOST} ^domain\.com$ RewriteRule ^(/)?$ /subfolder/index.php [L] Code (markup):