LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-08-2014, 04:25 AM   #1
circus78
Member
 
Registered: Dec 2011
Posts: 273

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 04:35 AM. Reason: better
 
Old 08-08-2014, 05: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



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

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

All times are GMT -5. The time now is 11:25 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
Open Source Consulting | Domain Registration