URL redirect/rewrite using the .htaccess file

Question
How do I create rewrites using .htaccess files?
Answer
There are a variety of rewrites and examples that can be used for htaccess. We will focus on a few of them, not all
Non WWW to WWW
				RewriteEngine on
				RewriteCond %{HTTP_HOST} ^domain.net
				RewriteRule ^(.*)$ http://www.domain.net/$1 [R=permanent,L]
								
non https to https
				RewriteEngine on
				RewriteCond %{REQUEST_URI} ^/ [NC]
				RewriteCond %{SERVER_PORT} !^443$
				RewriteRule ^(.*)$ https://ltn-secure.net/$1 [R=301,L]
				
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Do I need to restart Apache when I change an .htaccess file

Question Do I need to restart Apache when I change an .htaccess file Answer No, you do not...

Using htaccess to enable hotlink protection

Question How do I use htaccess to enable hotlink protection? Answer...

what is mod_rewrite? How do I get redirects working?

Question What is mod_rewrite? How do I get it working? Answer Our servers do...

How to use a SWF file as your homepage without embedding it into an HTML page.

Question How to use a SWF file as your homepage without embedding it into an...

Force SSL on all pages.

Question How do I force HTTPS instead of HTTP Answer...

Powered by WHMCompleteSolution

Our official partners