.htaccess: determining the base directory

Problems with the Windows version of XAMPP, questions, comments, and anything related.

.htaccess: determining the base directory

Postby legrega » 02. December 2011 18:37

I've need to access files with absolute addressing that is statring with src="/pic/image.gif"
because I use permalinks on my website.

How do I tell apache that my subdirectory /var/www/calivita is the root directory for accessing files under any subdirectory in /var/www/calivita/...?

I just wanto to access /var/www/calivita/pic/image.gif with url /pic/image.gif ... Is this possible?

Ive put .htaccess filee in /var/www/calivita with this line:
RewriteBase /calivita
Ive also tried
RewriteBase /var/www/calivita

but it doesn't seem to work
And I also restarted apache everytime I did some change (IS THIS NECESSARY??) but it just doesn't seem to work.
Please enlighten me on the matter!
legrega
 
Posts: 5
Joined: 03. December 2009 19:12

Re: .htaccess: determining the base directory

Postby JonB » 02. December 2011 21:13

I'm hoping you are running "XAMPP/LAMPP", is that correct??? What version of LMAPP???

If you are running LAMPP, your files should not be in /var/www, they should be in /opt/lampp/htdocs.

We only provide support here for XAMPP/LAMPP Apache issues. THis is becasue XAMPP/LAMPP does not work like a standard 'LAMP' Apache installation.

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: .htaccess: determining the base directory

Postby legrega » 03. December 2011 16:11

XAMPP 1.7.7 on win7 x64
because I have some permalinks like url/file/1 and url/file/2 I need to access the files through absolute addressing like /url/file
I do not know which command in .htaccess to use I 've tried RewriteBase but it just doesn't work?! Please help me configure .htaccess in base dir which already a a sub dir.
Thanks in advance, Grega
legrega
 
Posts: 5
Joined: 03. December 2009 19:12

Re: .htaccess: determining the base directory

Postby JonB » 03. December 2011 18:14

XAMPP 1.7.7 on win7 x64

WHY have you posted this in a Linux Board??? Please update your Profile in the User Control Panel

In answer to a very strange question -

The paths you are describing are LINUX/UNIX paths - they won't normally occur in a XAMPP installation unless you created them under htdocs. \xampp\htdocs is the Document Root in all Windows installations, unless you have changed it in httpd.conf or have set up Virtual Hosts. The Document Root is normally the 'starting point' for figuring out where a .htaccess file should be placed.

If you are asking questions about what to do on a non-xampp Linux install, this is not the right place - period, the question belongs on a different forum, this forum exists to answer questions relevant to XAMPP on each of its OS platforms.

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: .htaccess: determining the base directory

Postby legrega » 03. December 2011 20:12

Ive really do not want to impose but am sure this is an xampp issue...
I have dual boot wiht linux xampp and am currently on win7 with xampp.
Is it possibly to say in .htaccess file that the root directory is actually considered for one subdirectory like htdocs/project1/
and how to define htdocs/project1/.htaccess to access htdocs/project1/css/main.css as /css/main.css [note the first backslash before css]?
I've tried program file /xampp/htdocs/project1/.htaccess with:
RewriteBase C:\xampp\htdocs\project1\
and also in linux with
RewriteBase /xampp/htdocs/project1/

but it doesn't work. Please help me, thanks i advance, Grega
legrega
 
Posts: 5
Joined: 03. December 2009 19:12

Re: .htaccess: determining the base directory

Postby JonB » 03. December 2011 22:55

An Apache Alias directive might do what you want - as I recall they can be used that way at a folder level.

http://httpd.apache.org/docs/current/mod/mod_alias.html

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 106 guests