LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache mod_rewrite Subdirectories and IP question (https://www.linuxquestions.org/questions/linux-server-73/apache-mod_rewrite-subdirectories-and-ip-question-746991/)

mgichoga 08-12-2009 08:42 AM

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.


All times are GMT -5. The time now is 02:42 AM.