Forum Moderators: phranque
I want to redirect domain.com/folder to www.domain.com/folder while leaving the rest of the site as is for now.
I've place variations of attempts in .htaccess in domain.com/folder including the following:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ [domain.com...] [R=301,L]
I know I don't know what I'm doing, but what do I need to change to get this to work.
Thanks. I know these canonical type questions come up all the time and I'm grateful for any help.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^folder/(.*)$ http://www.example.com/folder/$1 [R=301,L]
If you wish to end-anchor the domain, then you'll need to accommodate the possibility of an appended port number, for example: RewriteCond %{HTTP_HOST} ^example\.com(:[0-9]+)?$ [NC]
Jim