Previously my host provider gave an option of setting up rewrite rules in apache configuration files. At that time below rule worked fine.
# Non WWW URLs to WWW URLs
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com$1 [R=301,L]
Right now I am moving all these rules to .htaccess and in every redirect, it adds the document root like /var/www/sites... in URL.
Why is this behaving differently ?
Redirectdirective, specified once, in the main web server configuration? Ideally .htaccess files should be reserved fordirectoryspecific configuration, notserverspecific. – Colin 't Hart Oct 01 '13 at 08:52.htaccess– GoodSp33d Oct 01 '13 at 10:39Redirectshould work in .htaccess files too http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect – Colin 't Hart Oct 01 '13 at 11:24