URL redirect rewrite using the .htaccess file

Create a 301 redirect for all http requests that are going to the old domain to new domain

If you are wanting to only redirect a specific subdomain, you would do something like this:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^olddomainname.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www.olddomainname.com$
  RewriteRule (.*)$ http://www.newdomainname.com/$1 [R=301,L]
</IfModule>

[or]
  
Redirect  301 /olddomainname http://www.newdomainname.com

Tags

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
2 + 4 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Instagram Without API

Could not reach Instagram server