PDA

View Full Version : Redirecting Visitors



sgoodman
2012-03-04, 04:12 PM
Greetings,

How can I use a .htaccess file to redirect visitors to another web site?

Thanks,
Shane.

suwunk
2012-03-04, 09:12 PM
Hi Shane,

Hope this help!

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]

Redirect to www

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

Cheers

sgoodman
2012-03-11, 04:13 AM
I finally figured it out:


RewriteEngine on
RewriteCond %{REQUEST_URI} !^/intranet([/\w\.-]*)*\/?$ [NC]
RewriteRule .* http://www.custompopups.comIt took a long time to get it working because I had to exclude visitors to the intranet subdirectory. But it finally works. I also realized I'm posting in the wrong forum. This is actually for my classic hosting account.

Shane.