LinuxQuestions.org
Visit Jeremy's Blog.
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-08-2014, 05:25 AM   #1
circus78
Member
 
Registered: Dec 2011
Posts: 222

Rep: Reputation: Disabled
Question on RewriteRule


Hi,
I need to create a RewriteRule (with Apache) in order to:

http://domain.com/everything -> http://www.domain.com/everything

how can I do this?

Thank you

Last edited by circus78; 08-08-2014 at 05:35 AM. Reason: better
 
Old 08-08-2014, 06:17 AM   #2
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 300
Blog Entries: 2

Rep: Reputation: 51
Add following code in your .htaccess file.
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
RewriteRule probem web_questions Linux - Networking 2 10-04-2012 02:49 PM
Apache RewriteRule help danster3k Linux - Server 3 10-06-2010 02:35 AM
Question about RewriteRule? your_shadow03 Linux - Newbie 12 12-27-2009 02:17 AM
Apache RewriteRule does not do what I want? Ujjain Linux - Server 0 03-26-2009 08:46 AM
Apache rewriterule mesh2005 Linux - Server 1 08-03-2007 03:23 AM

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

All times are GMT -5. The time now is 06:16 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration