Hi, I want to redirect this:
subdom.mydom.com/mydoc
TO
mydom.com/subdom/mydoc.php
Sorry for being too obvious. I know the htaccess rewritting basis but this is making me a little crazy :)
Hi, I want to redirect this:
subdom.mydom.com/mydoc
TO
mydom.com/subdom/mydoc.php
Sorry for being too obvious. I know the htaccess rewritting basis but this is making me a little crazy :)
I’ve never done any mod_rewrite stuff, but I imagine the regexes might look a bit like this:
Match:
([^\.]*).mydom.com/(.*)
Redirect to:
mydom.com/$1/$2.php
It's been a while, but it would be something like this (assuming you want all /whatever to redirect to /whatever.php):
RewriteEngine On
RewriteRule ^([^\.]+)\.mydom\.com/(.+) mydom.com/$1/$2.php
RewriteBase /
RewriteCond %{HTTP_HOST} !www.domain.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com [NC]
RewriteRule (.*) %2/$1 [L]