Page 1 of 1
.htaccess question
Posted: Tue Jul 31, 2007 4:57 pm
by intellivision
How to have a web directory think it's the site root, so that I can path images and hyperlinks anywhere under it to "/"?
Example of file structure:
Code: Select all
www/site1/site1-dev/images/image.jpg
Example of html I'm trying to use:
So I'd put an .htaccess file in site1-dev/ (right?) and what would its syntax be?
Re: .htaccess question
Posted: Wed Aug 01, 2007 7:12 am
by superdezign
intellivision wrote:So I'd put an .htaccess file in site1-dev/ (right?) and what would its syntax be?
You can put an .htaccess file anywhere.
Posted: Wed Aug 01, 2007 12:31 pm
by pickle
Not sure you'd even need an .htaccess file. I remember something about a BASE HREF tag that did just that.
Posted: Thu Aug 02, 2007 12:39 pm
by miro_igov
<base> will not help if the file is not in the web root.
If you are able to access the image through
http://domain.com/path/to/image.jpeg, then you can use the <base>
If the image is not in the web root you can add it's directory as alias in the apache config (valid only if you use apache)
Posted: Thu Aug 02, 2007 1:38 pm
by intellivision
Sorry guys, I should have been more clear. What I'd like to do is dev or test at a lower level directory like www/site1/site1-dev/ then move the files up to the production directory www/site1/ without having to change paths. Not just images, but anchor tags and others.
So that's what got me thinking that there's probably some way to get an .htaccess file in the dev directory make the web app think it's at root.
Posted: Thu Aug 02, 2007 1:50 pm
by nickvd
Why not use relative urls instead of absolute?
<img href="/images/logo.gif"> becomes
<img href="images/logo.gif">
Other than that, the <base> tag will be what you want.