Very simple .htaccess redirection question
Posted by: c1l1t (---.dsl.pltn13.sbcglobal.net)
Date: March 04, 2007 09:20AM

Hi,
I have 2 folders in my wamp application folder, wamp/www/site/private and wamp/www/site/public_html
I'm trying to redirect every single page to point to /public_html/*, here's my .htaccess:

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

I put the .htacces in /site and /site/public_html, but for some reason, whenever I go to localhost/site/, I always get a "Not Found" page, saying that /public_html doesn't exist.
I also tried to change the second line to:
RewriteRule ^(.*)$ /site/public_html/$1 [L]
But then I get the Internal Server Error page.
I've been trying to figure this out for hours, any help would be greatly appreciated.
Thanks.


Options: ReplyQuote
Re: Very simple .htaccess redirection question
Posted by: advancer77 (---.olp.net)
Date: March 04, 2007 05:33PM

forgive a newbie's ignorance, but I had a thought . . . could the second line be expecting an absolute file path (e.g. c:/wamp/.../site/public_html) instead of a relative one?

Options: ReplyQuote
Re: Very simple .htaccess redirection question
Posted by: c1l1t (---.dsl.pltn13.sbcglobal.net)
Date: March 04, 2007 09:19PM

I'm getting a 404 page when I used the absolute path, I tried to use:
RewriteRule ^(.*)$ public_html/index.php [L]
And it works, but when I replace index.php with $1 I get the internal server error page.
I have a feeling it's doing an infinite loop or something, I'll investigate more on this, thanks for the help though.

Options: ReplyQuote
Re: Very simple .htaccess redirection question
Posted by: advancer77 (---.olp.net)
Date: March 04, 2007 09:48PM

I'm not sure about your skill level; it is certainly beyond mine. I found the following site informative, however. It seems to be the sort of thing your are trying to do. Here's the link:
[httpd.apache.org]



Post Edited (03-04-07 21:50)

Options: ReplyQuote
Re: Very simple .htaccess redirection question
Posted by: c1l1t (---.dsl.pltn13.sbcglobal.net)
Date: March 05, 2007 09:44AM

I'm very sure that I'm a real noob, anyway, my guess was right, it was because of infinite loop, now I partially got it to work:
RewriteEngine on
RewriteCond ${REQUEST_URI} !^/?public_html/
RewriteRule ^(.*)$ public_html/$1 [L]

Now the only problem is, every single link I clicked will have public_html in it, eg: localhost/site/public_html/register. Arrgh!
Anyway, thanks for the link I'll check it out.

Options: ReplyQuote


Sorry, only registered users may post in this forum.