I need to understand url mod-rewrite but couldn’t get the basic at all.
I want to change http://www.domain.com/folder/page.php?id=1 to 1.domain.com
-
I created a wildcard subdomain (*.domain.com) and the problem is, where should I point the subdomain to? is it public_html/ or public_html/folder/ ?
-
Which htaccess file should I modify? is it in public_html/ or public_html/folder/ ?
-
What’s the link to the page.php? is it a href=”1.domain.com” or a href=”www.domain.com/folder/page.php?id=1″
Thank you very much 😀 really appreciate your help 😀
EDIT :
.htaccess code :
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([^.]+).domain.com$ [NC]
RewriteRule ^$ /file.php?item=%2 [QSA,nc]
I typed 1.domain.com but it’s showing no server found.
1 Answer