Connecting Tech Pros Worldwide Help | Site Map

URL rewrite in htaccesss

Newbie
 
Join Date: Mar 2007
Posts: 16
#1: Aug 21 '08
Hi all,

I have a doubt in redirecting a url in htaccess file. for example,

http://example.com/subfolder1/subfolder2 to http://www.example.com/subfolder1/subfolder2

How can do that in htaccess. 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

Thanks in advance....
Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,733
#2: Aug 23 '08

re: URL rewrite in htaccesss


Hi.

Check this out. Should tell you all you need to know about mod_rewrite.

Keep in mind tho that in order to enable mod_rewrite in your .htaccess files your main Apache configuration needs to allow overrides.
That is, the <Directory> matching your DocumentRoot has to have it's AllowOverride directive set to All.
Reply