How to redirect Sub domain as attribute in page with .htaccess
Posted
by
rkaartikeyan
on Stack Overflow
See other posts from Stack Overflow
or by rkaartikeyan
Published on 2013-06-30T11:12:53Z
Indexed on
2013/06/30
16:21 UTC
Read the original article
Hit count: 215
I want like this Ex:
http://user1.mysite.com
or http://user2.mysite.com
if anyone enter URL Like these on browsers it should go as bellow
http://mysite.com/user.php?userName=user1
How can i solve this with .htaccess
With help of Prix i solved this Issue
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.mysite\.com [NC]
RewriteCond %{HTTP_HOST} ^(.*)\.mysite\.com
RewriteRule ^(.*)$ http://mysite.com/user.php?userName=%1 [R=301]
Its working fine :)
http://user1.mysite.com
http://mysite.com/user.php?userName=user1 -> This one is working fine with Prix Code
Now i want Like Bellow. I have tried lot but not working. So again i don't have anyway rather than ask here.
I want like this
http://user1.mysite.com/inbox/
http://mysite.com/inbox.php?userName=user1
And also Like this
http://user1.mysite.com/message/1
http://mysite.com/view-message.php?userName=user1&messageID=1
© Stack Overflow or respective owner