LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-12-2009, 08:42 AM   #1
mgichoga
Member
 
Registered: Sep 2004
Distribution: Ubuntu
Posts: 42

Rep: Reputation: 16
Apache mod_rewrite Subdirectories and IP question


I have a problem I need help solving. I have a web server that I need to rewrite the URL's. Here is what I have in my .htaccess in my webroot directory

Quote:
#Force www in URL
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.example.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301]
#End force www in url
This works works well until someone enters this for example;

http://example.com/subdirectory

So these are my questions:

1. How can I force this rule to apply to all subdirectories?
2. I want to retain some content there that I can access via IP, is there a way to make it ignore requests that have been made through IP ? e.g http://1.2.3.4 should not be caught by the rule.

I tried to read around but I'm not quite effective with regex yet. Please point me in the right direction.
 
  


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
Apache mod_rewrite question Quantum0726 Linux - Software 0 03-31-2008 01:28 AM
How to enable Apache mod_rewrite, after apache installed without this modue jCash Linux - Newbie 1 10-24-2006 10:23 AM
Apache alias / subdirectories problems cavingreer Linux - Software 2 10-18-2004 03:16 PM
Hosting and using SubDirectories in Apache apocolipse Slackware 1 12-21-2003 10:11 PM
Apache (mod_rewrite) question Wonko the Sane Linux - Software 1 06-15-2003 12:55 PM

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

All times are GMT -5. The time now is 05:49 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