Forum Moderators: phranque
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{HTTP_HOST} ^www\.example\.com
RewriteRule ^hcupload/$ http://www.example.com/hello/upload\.cgi [L]
RewriteRule ^$ domaincake/ [L]
RewriteRule (.*) domaincake/$1 [L]
</ifModule>
Basically, I want for everyone going to www.example.com to be redirected into the domaincake folder on my server. However, when someone goes to www.example.com/hcupload I want them redirected to http://www.example.com/hello/upload\.cgi (only in this scenario though). I seem to be able to get this working when I take away the redirection to the domaincake folder but as soon as I include both at the same time, it won't work.. I think its wanting to redirect my www.example.com/hcupload into the domaincake folder. Please help, I've spent almost 2 days on this :( I hope its simple - I am a newb at regular expression. Thanks
[edited by: jdMorgan at 3:16 am (utc) on Aug. 1, 2007]
[edit reason] example.com [/edit]
This is what I want to happen:
www.example.com/hcupload/ -> http://www.example.com/hello/upload.cgi
www.example.com (or www.domain.com/anything else) -> www.example.com/domaincake
So in all cases redirect(or rewrite) to the domaincake folder EXCEPT when www.domain.com/hcupload is called.
The problem I think is that it thinks that www.example.com/hcupload/ is trying to redirect ALSO to BOTH www.example.com/domaincake AND www.example.com/hello/upload.cgi (thats my guess)
I get a 404 error when I try to accesss the CGI script through www.example.com/hello/upload.cgi AND www.example.com/hcupload/
I tried to be as clear as possible, any help would be SO MUCH appreciated!
Ahh the wonders of learning...
[edited by: jdMorgan at 3:17 am (utc) on Aug. 1, 2007]
[edit reason] example.com [/edit]
RewriteEngine on
#
RewriteRule ^\.htaccess$ - [F]
#
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com
RewriteRule ^hcupload/$ http://www.example.com/hello/upload.cgi [R=301,L]
#
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com
[b]RewriteCond $1 [i][/i]!^hello/upload\.cgi$[/b]
RewriteRule (.*) http://www.example.com/domaincake/$1 [R=301,L]
Also not sure why you're using external redirects, which require a second HTTP request, and expose the new/real URL-path to the client.
Jim
[edited by: jdMorgan at 3:23 am (utc) on Aug. 1, 2007]