.htaccess question

Status
Not open for further replies.

kjt

New Member
Howdy folks,
This might be a stupid question but I trying to figure out how to do a 301 redirect on the whole domain from http://www.thisisafakedomain.ie to http://thisisafakedomain.ie

Does anybody know how to do this? I've found the code for the opposite way:

Code:
 Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
Thanks in advance!
 

Forbairt

Teaching / Designing / Developing
Edit: ... nevermind ... misread :D
 

georgiecasey

New Member
just reverse the regex from the first example, no

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^www.domain.com [nc]
rewriterule ^(.*)$ http://domain.com/$1 [r=301,nc]
 

Forbairt

Teaching / Designing / Developing
Code:
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
so you'll want the opposite
Code:
rewritecond %{http_host} ^[URL="http://www.domain.com"]www.domain.com[/URL] [nc]
rewriterule ^(.*)$ http://domain.com/$1 [r=301,nc]
edit: beaten to it :D
 

kjt

New Member
Ugh I'm pretty sure I tried that out :confused:.


Thanks for the help lads,
Appreciate it!!
 
Status
Not open for further replies.
Top