When I test a website in my local installation of Apache I always have /mysite.com/<site files>
as the path. When the site gets deployed the root path will be just /
.
Because I need to use absolute referencing I have to use /mysite.com/files
on localhost and then change it everywhere for the remote server to simply /
.
How can I please do that better? Can I set something in .htaccess for this?
Best Answer
Put this in your .htaccess (in /):
RewriteEngine On
RewriteRule ^/mysite.com/(.*)$ http://yourwebsite.com/$1 [R=301]
If that doesn't work, replace the ^/mysite with ^mysite (I can't remember offhand where it starts matching).