Redirect ALL files on your Domain Site Redirect Code

Last Updated On: January 28, 2016

 

To redirect ALL files on your domain use this in your .htaccess  file if you are on a linux web server:

 

redirectMatch 301 ^(.*)$ http://www.site.net
redirectMatch permanent ^(.*)$ http://www.site.net

You can also use one of these in your .htaccess file:

READ MORE  Redirecting a domain to a website with a query string

redirect 301 /index.php http://www.site.net/index.php
redirect permanent /index.php http://www.site.net/index.php
redirectpermanent /index.php http://www.site.net/index.php

If you need to redirect http://site.net to http://www.site.net and you’ve got mod_rewrite enabled on
your server you can put this in your .htaccess file:

READ MORE  How to avoid logging of 404 missing files into error_log

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site\.net
RewriteRule ^(.*)$ http://www.site.net/$1 [R=permanent,L]