Home .htaccess Redirect .net/.org/.info to .com for ANY domain name
Reply: 0

.htaccess Redirect .net/.org/.info to .com for ANY domain name

user746
1#
user746 Published in June 19, 2018, 6:22 pm

Struggling to work out how to use Apache redirects in .htaccess to redirect ANY domain to it's .com.

e.g.:

  • domain1.net >> domain1.com
  • domain1.org >> domain1.com

  • domain2.net >> domain2.com

  • domain2.org >> domain2.com

...

  • domainX.net >> domainX.com
  • domainX.org >> domainX.com

It needs to work with any domain, so the answer can't include "example.com" etc.

Something like this:

RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)\.(?:net|org)$ [NC,OR]
RewriteRule ^(.*)$ http://%1.com/$1 [R=301,NE,L] 

But that's not working, it's losing the middle bit of the domain (e.g. "domain1").

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.329084 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO