Configure .htaccess URL to subdomain
Example 1: https://webmasters.stackexchange.c-om/questions/100872/htaccess-change-subdomain-add-a-custom-file-extension-and-url-parameters/100890 www.example.com/path/index.php?user=username&option=optname to username.example.com/path/optname.html <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com [NC,OR] RewriteCond %{HTTP_HOST} ^www.example.com [NC] RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC] </IfModule> Example 2: https://stackoverflow.com/questions/17907596/htaccess-redirect-to-subdomain-based-on-query-string-parameter Example: http://example.com/message.php?id=subdomain to http://subdomain.example.com/message.php <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?example.com$ [NC] RewriteCond %{QUERY_STRING} ^id=(.*)$ RewriteRule message.php http://%1.example.com/message.php? [R=301,L] </IfModule>
Comments
Post a Comment