Cenzic 232 Patent
Paid Advertising
sla.ckers.org is
ha.ckers sla.cking
Sla.ckers.org
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:
/www/website.com/trunk

I can access it via my web browser at h++p://localhost/website.com/ (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/(.*) /website.com/index.php/$1 [L]

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

RewriteRule ^/(.*) /website.com/extras/$1/ [L]
With second two rewrite rules I want for any requests that are like h++p://localhost/website.com/SUB_DIR
have it first try: /www/website.com/trunk/SUB_DIR
and if that's not found try: /www/website.com/trunk/extras/SUB_DIR
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/website.com/trunk/extras/SUB_DIR/ exists.

Any ideas?

-tx @ lowtech-labs.org

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

@tx

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:-
localhost:1234

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

------------------------------------------------------------------------------------------------------------
"People who say it cannot be done should not interrupt those who are doing it.";
labs : [www.businessinfo.co.uk]
blog : [www.thespanner.co.uk]
Hackvertor : [hackvertor.co.uk]



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/website.com/SUB_DIR
and /www/website.com/SUB_DIR 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/website.com/SUB_DIR doesn't exist.

-tx @ lowtech-labs.org



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.