Reputation: 134
I would like to rewrite an url, but I always do not get any adequate results.
I would like the url http://something.domain.com/index.php?arguments... to actually visit http://domain.com/index.php?username=something&arguments...
I have tried with making a wildcard entry *.domain.com and using some code on the internet, but nothing worked.
I keep getting a "Default Website Page" Any ideas how to solve this problem?
Upvotes: 0
Views: 1054
Reputation: 134
Thank you for the help! It seems that I do not have to add a wildcard dns entry, but to create a wildcard sub-domain in cpanel.
Upvotes: 0
Reputation: 786359
You can use this code in your DOCUMENT_ROOT/.htaccess
file of something
domain:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]+)\.(domain\.com)$ [NC]
RewriteRule ^(index\.php)$ http://%2/$1?username=%1 [L,QSA,NC,R]
Upvotes: 1