Forum Moderators: phranque
I have a doubt in redirecting a url in htaccess file. For eg, if a user types [domain.com...] then it should
redirect it to http://www.example.com/subfolder1/subfolder2/. I have tried in google but still not able to find a
proper solution. Anybody else pls help me. I am using cakephp for my application. And one more problem for me is if i type the url as
http://example.com/subfolder1/subfolder2, the subfolder2 is not opening (i.e without trailing slash). If i enter with slash(i.e
http://example.com/subfolder1/subfolder2/) it is working. how to clear that also using htaccess file. Pls help me.
Thanks in advance...
You should use Apaches mod_rewrite module. It can do exactly what you need. There are many great tutorials around the web, just search using your favourite search engine. Some of these are right here at webmasterworld, just click the 'Library' link at the top. In particular check out these:
[webmasterworld.com...]
[webmasterworld.com...]
Another, quick-and-easy (but not good!) method is to use:
Redirect /olddirectory/old.php [newsite.com...]
in htaccess.
But mod_rewrite is a preferred solution.