I have a blog that is installed in a folder. Basically, let’s say my blog is installed in www.example.com/folder/
I would like to have correct 301 redirects as it follows:
example.com -> www.example.com/folder/
www.example.com -> www.example.com/folder/
example.com/index.php -> www.example.com/folder/
www.example.com -> www.example.com/folder/
I have two htaccess files (one in / and one in /folder). The one in /folder is updated by wordpress.
htaccess in root:
RewriteCond %{REQUEST_URI} !^/carte/
RewriteCond %{HTTP_HOST} ^(www.)?cemaicitesc.
RewriteRule ^(.*)$ /carte/$1 [L]
htaccess in /folder:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /carte/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /carte/index.php [L]
</IfModule>
Currently, if I type in the browser example.com, it stays on example.com.
Can you help? I always have hard time using htaccess redirects so I prefer to ask before testing.
Thank you!
Just try change RewriteRule in root .htaccess
Where http://www.example.com is your domain name with www prefix
R=301
make redirect. In your example you just rewrite URL.