1

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?

1
  • 1
    Add the code you have tried to your question. What error are you getting? If you access 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?
    – MrWhite
    Nov 5 '16 at 15:14
1

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]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.