I’m trying to create some redirects with .htaccess but I never manage to get it fully functional. Maybe someone here can help me.
What I need is:
-
http://domain.seandhttp://domain.comto redirect tohttp://www.domain.com. -
I also need
http://domain.se/somefolder,http://domain.com/somefolderas well ashttp://www.domain.se/somefolderto redirect tohttp://www.domain.com/folder.
I’ve tried to accomplish this myself but all I end up with is errors about data not being sent.
This is to be placed in .htaccess file in website root folder. If placed elsewhere some tweaking may be required.
First rule will rewrite (internal redirect) requests to
/somefolderto/folder. If you need this to be 301 Permanent Redirect, then replace[L]by[R=301,L]Second rule will do domain redirect job. This rule will ONLY redirect if domain is
domain.comordomain.se. If you want to have redirect from ANY domain name (that your webserver is configured can serve) towww.domain.comthen replace those 2 RewriteCond lines with this one:RewriteCond %{HTTP_HOST} !=www.domain.com.