I'm trying to redirect this url:
www.example.com/path/index.php?user=username&option=optname
to
username.example.com/path/optname.html
I tried several ways but I'm getting errors. How to do that?
Webmasters Stack Exchange is a question and answer site for pro webmasters. It only takes a minute to sign up.
Sign up to join this communityI'm trying to redirect this url:
www.example.com/path/index.php?user=username&option=optname
to
username.example.com/path/optname.html
I tried several ways but I'm getting errors. How to do that?
Here's the sample rewrite commands you should be looking for:
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]
username.example.com/path/optname.html
directly does it work OK? "add a custom file extension and url parameters" - You state "add" in the title, but it looks like you want to "remove" these in your example?