I believe I am missing something and do not think I truly know how rewriteBase works.

The issue I've is the fact that I've got a production site in which the site is incorporated in the root directory yet I've my development site inside a localhost subdirectory. Eg http://www.sitename.com/ versus http://localhost/sitename/

Basically have for instance an images folder I wish to reference the pictures in the site root using the initial slash within the href. Eg Utilizing a relative href (with no initial slash) isn't a choice. This works around the production site however the development website is searching for http://localhost/images/imagename.digital rather than http://localhost/sitename/images/imagename.digital

And So I thought all I desired to complete was setup the next during my .htaccess file to pressure the website root to my subdomain inside the development atmosphere:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /sitename

But this still uses localhost because the site root rather than localhost/sitename.

Can anybody please produce some pointers?


I ended trying to get this done within the .htaccess file and attempted to simply make use of the html command but this did not work.

Ultimately I setup Virtual Hosts in Apache around the local server however it appears like such a great deal of overkill to simply alter the site root. I am also concerned that other designers around the LAN network will not have the ability to access the website correctly through the virtual host.

I am really requiring some 'best practice' advice please on establishing a workable development atmosphere in WAMP.

RewriteBase alone, essentially, informs Apache where you can apply the RewriteRules. Here you do not have any. Incidentally, you may either take away the RewriteBase directive altogether, or change it out to:

RewriteBase /

The next two lines should get results for the development atmosphere only:

RewriteCond %{ REQUEST_FILENAME } !-f
RewriteRule ^(.+)$ /sitename/$1 [L,QSA]

Both of these directives mean: "when the asked for file doesn't exist (-f), and just for the reason that situation, rewrite the url prepending /sitename/ towards the asked for URI ($1)".

For more information you are able to take a look at Apache mod_rewrite docs and Apache URL rewriting guide.