Apache rewriteBase in .htaccess for development subdomains

Posted by Das123 on Stack Overflow See other posts from Stack Overflow or by Das123
Published on 2010-05-28T05:25:23Z Indexed on 2010/05/28 5:31 UTC
Read the original article Hit count: 323

Filed under:
|
|

I think I'm missing something and don't think I really understand how rewriteBase works.

The problem I have is that I have a production site where the site is in the root directory yet I have my development site in a localhost subdirectory. Eg http://www.sitename.com/ vs http://localhost/sitename/

If I have for example an images folder I want to reference the images from the site root by using the initial slash in the href. Eg Using a relative href (without the initial slash) is not an option. This will work on the production site but the development site is looking for http://localhost/images/imagename.jpg instead of http://localhost/sitename/images/imagename.jpg

So I thought all I needed to do was setup the following in my .htaccess file to force the site root to my subdomain within the development environment:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /sitename

But this still uses localhost as the site root instead of localhost/sitename.

Can anyone please give me some pointers?

© Stack Overflow or respective owner

Related posts about apache

Related posts about .htaccess