Portal Home > Knowledgebase > Articles Database > htacceess certain folders - HELP


htacceess certain folders - HELP




Posted by the moose, 08-01-2008, 12:50 PM
hi there I really need some help with this - really struggling now... I would like to redirect the following: mydomain.com/ea1/eb1 - > mydomain.com/page?first=ea1&second=ea2 mydomain.com/ea2/eb2 - > mydomain.com/page?first=ea2&second=ea2 mydomain.com/ea3/eb3 - > mydomain.com/page?first=ea3&second=ea3 now, i can write the htaccess to do this, but what I have written conflicts with some wordpress archives. Now this is not good! And causes a 404 error. I want to ONLY redirect those 3 URLs, and anything else left alone. How do I do this PLEASE HELP!!!! the moose

Posted by the moose, 08-01-2008, 12:52 PM
p.s. mydomain.com would usually have the H T T P and all the w's but as im a noob, im not allowed to post them!

Posted by the moose, 08-01-2008, 12:56 PM
note...again... i would like to use rewrite rather than redirect, so that the original URL stays in the address bar

Posted by rosshwht, 08-03-2008, 03:46 AM
In you .htaccess in the www root directory (typically public_html). ************ RewriteEngine on RewriteRule ^/ea1/eb1$ /page?first=ea1&second=ea2 [L] RewriteRule ^/ea1/eb2$ /page?first=ea2&second=ea2 [L] RewriteRule ^/ea1/eb3$ /page?first=ea3&second=ea3 [L] ************ That will affect all calls to this site under any domain - with the exact URL specified. You need to read the docs at apache.org for the mod_rewrite module for other changes. Enjoy rossh

Posted by the moose, 08-03-2008, 04:49 AM
thank you for your reply. if i wanted to make it so that the value was passed to second= via a variable ($1/$2 probably), how would I go aobut doing this? cheers the moose

Posted by inspiritnetworks, 08-03-2008, 08:41 PM
Use something like this: RewriteEngine on RewriteRule ^/ea1/eb1$ /page?first=ea1&second=ea2 [L] RewriteRule ^/ea1/eb2$ /page?first=ea2&second=ea2 [L] RewriteRule ^/ea1/eb3$ /page?first=ea3&second=ea3 [L] Not 100% or even 80% sure but something like that is what I used before BTW That's to fix htaccess only limited to one directory.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Error 403 (Views: 744)


Language: