Forum Moderators: phranque
This is my first post so I would like to have Jim address this because I've read so much inquiries answered by him with positive feedback.
Ok, here is my rewrite code written at .htaccess file:
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com [NC]
Rewriterule ^dir/index\.html [mysubdomain.mydomain.com...] [R=301,L]
I get to see the resulting URL correctly but not the contents that I am expecting.
I actually get to see the index page of my website root directory.
how should I fix this?
Thanks a lot in advance.
Welcome to WebmasterWorld!
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com [NC]
RewriteRule ^dir/index\.html [mysubdomain.mydomain.com...] [R=301,L]I get to see the resulting URL correctly but not the contents that I am expecting.
Normally, you'd have a second ruleset that would 'map' subdomain requests to a subdirectory, something like:
RewriteCond %{HTTP_HOST} ^mysubdomain\.mydomain\.com
RewriteRule (.*) /mysubdomain_subdirectory/$1 [L]
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com [NC]
RewriteRule ^mysub/paths/index\.php?id=1$ [dirtydomain.mydomain.com...] [R=301,L]
but this didn't worked. I mean, I still see the same URL. I need to change the URL as [dirtydomain.mydomain.com...] Or more precisely, I need to change the URL dynamically for each user on my site. Just like [newuser1.mydomain.com,...] [newuser2.mydomain.com...etc...] of course, this goes whenever the 'id' attribute in the index.php page changes value...
Any idea?
If you want to rewrite ^mysub/paths/index\.php?id=<any_username> to http://dirtydomain.mydomain.com/<any_username>
Then the rule would be:
RewriteCond %{QUERY_STRING} id=([^&]+)
RewriteRule ^mysub/paths/index\.php$ http://dirtydomain.mydomain.com/%1? [R=301,L]
^mysub/paths/index\.php?id=<any_username> to [<any_username>.mydomain.com...]
Thus, I wanted that every page request having this form: index.php?id=<somevalue> would display this URL: [<somevalue>.mydomain.com...] having the original contents...
Just that currently, the URL is correct but the contents is wrong (displays the contents of the index page in my root directory)
Hope, I explained it well... :)
Thanks in advance!