LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-02-2014, 06:32 AM   #1
mitter1989
Member
 
Registered: Sep 2013
Posts: 47

Rep: Reputation: Disabled
Question redirect non www site to www site with 301 status


Hi Folks,

I want to redirect my non www site to www site every time as google suggests.

I have RHEL 6.3(x86_64) and apache version : Apache/2.2.15,

I have created following rule in .htaccess file but it is not working for me and showing nothing and keeps refreshing page again and again, looks like looping.

Please guide me how can I achive this.

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.xyz\.com
RewriteRule (.*) http://www.xyz.com/$1 [R=301,L]
 
Old 08-02-2014, 07:53 AM   #2
rhnylmz
LQ Newbie
 
Registered: Aug 2014
Location: Istanbul
Posts: 6

Rep: Reputation: Disabled
Can you try again with the following rule:
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^xyz\.com$ [NC]
RewriteRule ^(.*)$ http://www.xyz.com/$1 [R=301,L]
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
want to redirect www.domain.com/folder www.domain100.com figure20012 Linux - Newbie 2 09-27-2012 10:32 PM
Apache site redirects using what rule? foo.site.com -> www.site.com/foo LaughingBoy Linux - Server 2 04-16-2009 09:51 PM
www.slackware.com site down? bsdunix Slackware 12 02-08-2008 08:00 AM
site - www.tuxiscool.com fester2001 Linux User Groups (LUG) 2 01-23-2007 12:55 PM
Have a look at this site www.linuxsucks.com! Bert Linux - General 20 05-19-2002 02:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration