Forum Moderators: phranque
users on my site will get their own subdomain username.mydomain.com
i need to redirect that url to www.mydomain.com/subdir/username/
so my question is how do i use mod_rewrite so that whatever subdomain (username) is entered into the url will be picked up and redirected to the appropriate subdirectory?
i understand i have to place a .htaccess file in the root directory, but how do i code this?
thanx!
o
Welcome to WebmasterWorld!
This subject has been pretty well-covered here. I suggest doing a search [google.com] and reading those threads as well as the references cited in our charter [webmasterworld.com].
Mod_rewrite is not something that you can just cut-n-paste with any success, so a bit of studying/learning is most probably going to be required.
Jim
If you really have no ideas on mod_rewrite, I suggest reading this, so you have an idea of the answer you will get:
[webmasterworld.com...]
Then when you have an idea, this one seems to address the specific question you are asking:
[webmasterworld.com...] (This may not be the one I was thinking, if it does not help, Please follow Jim's suggestion... We were posting at the same time =).)
When you are done with those, take your best guess and we'll help you from there.
Hope this gives you some ideas.
Justin
thanx!
ohad
--------
Redirect permanent /mail [example.com...]
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://example.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://example.com$ [NC]
RewriteCond %{HTTP_REFERER} !^https://example.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https://example.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.example.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.example.com$ [NC]
RewriteCond %{HTTP_REFERER} !^https://www.example.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https://www.example.com$ [NC]
RewriteRule .*\.(jpg¦jpeg¦gif¦png¦bmp)$ http://www.example.com [R,NC]
[edited by: jdMorgan at 10:47 pm (utc) on May 19, 2005]
[edit reason] Examplified. [/edit]