.htaccess tutorial

htaccess Elite


Redirect non-existing folder to subdomain

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

Redirect non-existing folder to subdomain

New postby twomeanings » 15 Feb 2008 01:57

I want to redirect all users that go to http://www.coolcherrycream.com/kinks/ to http://fan.coolcherrycream.com/kinks/ but the /kinks/ folder does not exist and there are no files in it -- the content I want them to see is actually in /fan/kinks/.

This code works to redirect everything in http://www.coolcherrycream.com/fan/ to http://fan.coolcherrycream.com/

Code: Select all
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?coolcherrycream.com$
RewriteRule ^fan/?(.*)$ http://fan.coolcherrycream.com/$1 [R,L]


So by that logic, I think this code should work to achieve what I want:

Code: Select all
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?coolcherrycream.com$
RewriteRule ^kinks/?(.*)$ http://fan.coolcherrycream.com/kinks/$1 [R,L]


However, it looks like I need to add just a little something to the second code because the /kinks/ folder does not actually exist in the main directory. What exactly is this little something?
twomeanings
 
Posts: 1
Joined: 15 Feb 2008 01:53

Return to Redirect or Rewrite Questions