Forum Moderators: phranque
I have a domain, say xyz.us.to.
I would like to rewrite (not redirect) xyz.us.to to /xyz and all its files, dirs, subdirectories, etc. to /xyz/(files, etc.).
(/ is document root in .htaccess)
This is my current .htaccess:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^xyz\.example\.com [NC]
#RewriteRule ^/*$ /xyz/$1 [L]
RewriteCond %{REQUEST_URI} ^/123
RewriteRule ^(.*)$ /xyz/$1 [L]
(therefore, [xyz.example.com...] goes to /xyz/123)
However, I can only hard code it (folder 123), which would take too long to write. Is there a better way, preferably using regular expressions?
Thanks in advance! :)
jimhap
[edited by: jdMorgan at 2:49 am (utc) on Mar. 31, 2009]
[edit reason] example.com [/edit]
Now it's almost there... but there's one other thing.
New .htaccess:
RewriteEngine on
RewriteCond %{HTTP_HOST} xyz\.example\.com [NC]
RewriteCond $1 !^xyz/
RewriteRule ^(.*)$ /xyz/$1 [L]
So... if I go to xyz.example.com/123 it throws me to xyz.example.com/xyz/123. It does point to the right directory, though.
Is there any way to fix that?
Thanks!
jimhap
[edited by: jdMorgan at 2:50 am (utc) on Mar. 31, 2009]
[edit reason] example.com [/edit]
There's nothing in the rule posted above that would invoke a redirect.
Jim