Welcome to Server Circle. It's a friendly site and all levels of experience are welcome. Be aware that we use cookies for your login.
Server Circle - Ask questions about Servers and get answers from experts.
Beta (0.05 sec)
Docs for Apache mod_rewrite

I'm struggling with redirecting this:



http://www.domain.com

to

domain.com


Any good tutorials out there ? Or a simple example ? The ones I've found aren't helping :-(
Asked by:
Trinity
2782 points
 Report Abuse
 Share Page - Category: Linux Servers - Tags: Docs for Apache mod_rewrite
 Enter your response
Please use Pastie.org to paste lengthy code or to fix formatting issues with code
  • Responses in reverse (2)

This should work:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www.your_domain.com$

RewriteRule ^(.*)$ http://www.your_domain.com/$1 [R=301]


Change the domain bits as appropriate. There is a way to do this without the domain even, but can't off hand remember it and don't want to give out broken code.

Response by:
trevHCS
640 points

Response by:
Mayhew
982 points


  • Related Questions
About Us : Contact Us : Etiquette : Terms : CDN Failover : ShorterURL : CDN Fallback : © 2013 Server Circle