Forum Moderators: phranque

Message Too Old, No Replies

Rewrite sub-folder

htaccess help..

         

eddie67

10:27 am on Jul 9, 2010 (gmt 0)

10+ Year Member



I would like to rewrite my url

http://example.com/booking/
to
http://www.example.com/booking/

In root url I have this htacces-file:

RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

My root url is rewriting perfect, but for some reason it does not apply to my folder /booking/

Could someone please help?

Thanks,
regards
Eddie

[edited by: jdMorgan at 5:53 pm (utc) on Jul 10, 2010]
[edit reason] example.com [/edit]

jdMorgan

6:00 pm on Jul 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would like to redirect requests for the url
http://example.com/booking/
to
http://www.example.com/booking/

Assuming that "/booking" is a physical folder below the folder containing this .htaccess file, then the code would be:

RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [NC]
RewriteRule ^booking(/.*)?$ http://www.example.com/booking$1 [R=301,L]

If that does not work, then you've got some other code that is interfering. Also, completely delete your browser cache before testing any new server-side code like this.

Jim