Paid Advertising is
ha.ckers sla.cking
For any nonsense or banter that doesn't fit anywhere else. LoL! omg! ROFL! 
Go to Topic: PreviousNext
Go to: Forum ListMessage ListNew TopicSearchLog In
mod_rewrite question
Posted by: tx
Date: February 25, 2008 06:47PM

Hey guys, maybe someone around here can help me out with this mod rewrite issue I'm having.

I have a site located at let's say:

I can access it via my web browser at h++p://localhost/ (there is an Alias set up in httpd.conf to point that to the correct directory so I don't need to include 'trunk')

I'm have some rewrite rules like the following in the .htaccess in the trunk directory:
RewriteRule ^index/(.*) /$1 [L]

RewriteRule ^/(.*) /$1/ [L]

RewriteRule ^/(.*) /$1/ [L]
With second two rewrite rules I want for any requests that are like h++p://localhost/
have it first try: /www/
and if that's not found try: /www/
and if that's not found go ahead and return 404. But no matter how I change it, I always get 404, even though I'm positive that /www/ exists.

Any ideas?

-tx @

Options: ReplyQuote
Re: mod_rewrite question
Posted by: Gareth Heyes
Date: February 26, 2008 03:14AM


Would not not be easier to just have the trunk directory as the web site root?

I use ports on my local machine to simulate a live environment like:-

So my local apache config looks like this:-
Listen 1234
<VirtualHost x.x.x.x:1234>
ServerName x.x.x.x:1234
DocumentRoot "/www/"

"People who say it cannot be done should not interrupt those who are doing it.";
labs : []
blog : []
Hackvertor : []

Edited 2 time(s). Last edit at 02/26/2008 05:14AM by Gareth Heyes.

Options: ReplyQuote
Re: mod_rewrite question
Posted by: tx
Date: February 26, 2008 07:08PM

Yeah, for my local environment I've been meaning to set up some vhosts... just (busy | lazy) I guess :P
But that's a bit of a moot point as it doesn't work in my staging environment either which doesn't have any of those aliases, just a standard vhost pointing to docroot.

When I request: h++p://localhost/
and /www/ exists it works fine (for the sake of argument we'll pretend my staging environment and my local development environment have the same file system). Of course it worked fine before the last two rewrite rules were in place anyway because, well, that subdirectory actually exists. I just can't seem to figure out how to get apache to look in another sub-directory if /www/ doesn't exist.

-tx @

Edited 1 time(s). Last edit at 02/26/2008 07:09PM by tx.

Options: ReplyQuote

Sorry, only registered users may post in this forum.