url_rewrite to subdomain |
[eluser]danfreak[/eluser]
Hey guys, I must rewrite with header [R=301] (namely redirect permanently) all my uri to say for exmple Code: http://www.mysite.com/example/any-file.php to Code: http://example.mysite.com/any-file.php Anyone has any suggestion about an .htaccess trick? Dan
[eluser]Michael Wales[/eluser]
Quote:RewriteEngine on Not sure how to go about dynamically matching the condition but hopefully it gets you pointed in the right direction. This is just a google search result. http://www.webmasterworld.com/forum92/1763.htm
[eluser]danfreak[/eluser]
cheers I'll try that out and I'll let you know! I also found this great tutorial: .htaccess tips & tricks
[eluser]Michael Wales[/eluser]
Thanks for the link - htaccess and regex is definitely something I need to work on. Am I the only one that has to get some insane Googlefu and test 100 times before I get the right combination to work for me?
[eluser]Michael Wales[/eluser]
Speaking of which - here's another link that has some great htaccess tips/tricks (plus many other things). I keep it in my Feed Reader: http://www.askapache.com/
[eluser]danfreak[/eluser]
Hey Michhael, your rule works great but... In the root directory I have the following .htaccess Code: <IfModule mod_rewrite.c> Namely the Code: RewriteCond %{REQUEST_FILENAME} !-d tells "if a directory exists, don't do any rewrite" I would like to tell: Code: if the directory exists but it is "example" (i.e. http://www.mysite.com/example/(anyUri)) redirect to http://example.mysite.com/(any-uri)
[eluser]Michael Wales[/eluser]
I believe mod_rewrite works from top to bottom, so just place the ruleset in the following order: Quote:<IfModule mod_rewrite.c> |
Welcome Guest, Not a member yet? Register Sign In |