.htaccess tutorial

htaccess Elite


Redirect all request to example.com/pics to pics.example.com

Ask your mod_rewrite and Redirection questions here, and get answers!

Redirect all request to example.com/pics to pics.example.com

New postby zylox » 12 Jan 2008 16:06

Hi!

I would like to create a Rewrite rule which will forward all requests from http://example.com/pics to http://pics.example.com including all arguments. So if someone goes to http://example.com/pics/gallery1/image1.jpg.html it should also be redirected to http://pics.example.com/gallery1/image1.jpg.html

How can I achieve this? I've searching for hours but couldn't find a solution yet.

Any help will be greatly appreciated!
zylox
 
Posts: 2
Joined: 12 Jan 2008 16:02

New postby zylox » 13 Jan 2008 13:09

The solution:

Code: Select all
RewriteEngine On

RewriteRule ^pics$  http://pics.example.com [R,NC]
RewriteRule ^pics/(.*)  http://pics.example.com/$1  [R,NC]
zylox
 
Posts: 2
Joined: 12 Jan 2008 16:02


Return to Redirect or Rewrite Questions