I currently have a url system like this using htaccess:
- www.domain.com/member/username - www.domain.com/member/username/contact - www.domain.com/member/user/album/title-of-the-album/albumID
.. something like that
Here is my htaccess and it worked perfectly.
RewriteRule ^member/([a-zA-Z0-9_-]+)$ member.php?username=$1 RewriteRule ^member/([a-zA-Z0-9_-]+)/contact$ contact.php?username=$1 RewriteRule ^member/([a-zA-Z0-9_-]+)/album/([a-zA-Z0-9_-]+)/([0-9]+)$ album.php?username=$1&title=$2&album_id=$3
Now I want to configure a dynamic subdomain system for the user, I like "username.domain.com" Therefore, I decided to use htaccess below:
RewriteCond %{HTTP_HOST} !^www\.domain\.com RewriteCond %{HTTP_HOST} ([^.]+)\.domain\.com [NC] RewriteRule ^(.*)$ www.domain.com/member/%1 [L]
But this redirects the user to his old domain "www.domain.com/member/username" instead of "www.domain.com/member/username" I want the user to remain in "username.domain.com" (without changing the URL addresses in the address bar).
If possible, is it possible to keep the same structure for another new URL, for example, when I type:
- "username.domain.com/contact" will load the contents of "www.domain.com/member/username/contact" (without changing the URL in the address bar)
- "username.domain.com/album/title-of-the-album/albumID" will load the contents of "www.domain.com/member/username/album/title-of-the-album/albumID" (without changing the URL in the address bar)
Please, help!!
source share