www.domainname.com to domainname.com

Using a single web hosting account to host multiple sites

www.domainname.com to domainname.com

Postby rintoadi » Sun Nov 25, 2007 4:02 pm

i have this for my htaccess:
Code: Select all
RewriteEngine On
RewriteBase /
RewriteRule ^detail detail.php
RewriteRule ^list- list.php


I want to add some line, so that will redirect http://www.domain.com to http://domain.com

can you help me? thnks.
rintoadi
 
Posts: 2
Joined: Tue Nov 06, 2007 3:14 pm

Postby richardk » Mon Nov 26, 2007 12:02 pm

Code: Select all
Options +FollowSymLinks

RewriteEngine On

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

RewriteRule ^detail /detail.php [QSA,L]
RewriteRule ^list-  /list.php   [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

it's work

Postby rintoadi » Mon Nov 26, 2007 2:27 pm

thank you. it's work.
rintoadi
 
Posts: 2
Joined: Tue Nov 06, 2007 3:14 pm

Postby donjones76 » Tue Jan 22, 2008 6:28 pm

I have the opposite question. from domain.com to www.domain.com and keep my existing rewrites

Code: Select all
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule .* http://www.domain.com/$ [R=301,L]

RewriteRule ^home/$ /index.php [QSA,L]
RewriteRule ^purchase-gift-certificates/$ /checkout.php [QSA,L]


I keep getting 500 server error
donjones76
 
Posts: 1
Joined: Tue Jan 22, 2008 6:23 pm

Postby richardk » Wed Jan 23, 2008 11:20 am

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

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

RewriteRule ^home/$                       /index.php    [QSA,L]
RewriteRule ^purchase-gift-certificates/$ /checkout.php [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 25 guests

cron