Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

.htaccess rewrite (301) help '3 conditions not working together'


NodsDorf

Recommended Posts

Posted

I need to 301 redirect

www.thesite.net

thesite.net

thesite.com

 

to

www.thesite.com appending the specific page to the url.

 

I have the following

RewriteEngine On

RewriteCond %{HTTP_HOST} ^thesite.net [NC]
RewriteCond %{HTTP_HOST} ^www.thesite.net [NC]
RewriteCond %{HTTP_HOST} ^thesite.com [NC]
RewriteRule ^(.*)$ http://www.thesite.com/$1 [L,R=301]

This does not work, and I don't see any error, granted .htaccess is not my strong point.

 

 

But if I do any 1 of these conditions individually with the RewriteRule they work.

Example:

RewriteCond %{HTTP_HOST} ^thesite.com [NC]
RewriteRule ^(.*)$ http://www.thesite.com/$1 [L,R=301]

Works perfectly.

 

If I join them with another condition they all fail.

 

Anybody know whats up?

Posted

Figured it out,

 

I guess there is an [OR] command I wasn't privy to, and the [NC] wasn't really applicable.

 

Issue Fixed

RewriteEngine On

RewriteCond %{HTTP_HOST} ^thesite.net [OR]
RewriteCond %{HTTP_HOST} ^www.thesite.net [OR]
RewriteCond %{HTTP_HOST} ^thesite.com
RewriteRule ^(.*)$ http://www.thesite.com/$1 [L,R=301]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...