Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I currently have a site setup with the following in httpd.conf:

<VirtualHost x.x.x.x:80>
 ServerName testsite
 ExpiresActive On
 ExpiresByType image/gif A2592000
 ExpiresByType image/png A2592000
 ExpiresByType image/jpg A2592000
 ExpiresByType image/jpeg A2592000
 ExpiresByType text/css A2592000
 ExpiresByType application/x-javascript A1
 ExpiresByType text/javascript A1
 AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript

 DocumentRoot /usr/local/www/apache22/data/thesite/trunk

 RewriteEngine On
 RewriteRule !\.(htc|js|tiff|gif|css|jpg|png|swf|ico|jar|html|doc|pdf|htm|xml)$ %{DOCUMENT_ROOT}/../platform.php [L]
</VirtualHost>

Where x.x.x.x is my IP.

At the moment it forwards anything which is not in the set (htc|js|tiff|gif|css|jpg|png|swf|ico|jar|html|doc|pdf|htm|xml) to platform.php

How htp://x.x.x.x/phpmyadmin to also forward. Would it be possible to only perform this rewrite conidtion if I am in a subdirectory. Eg. http://x.x.x.x/projectone So htp://x.x.x.x/projectone/login would direct to the platform.php

Thanks

share|improve this question

2 Answers 2

Put your mod_rewrite directives inside a Location or Directory container if you only want to apply them on a certain location or directory.

share|improve this answer
    
LocationMatch would probably be better suited in this case - the poster then wouldn't have to explicitly set the name of the location/directory, it could match any. –  Andy Shellam Feb 28 '10 at 11:52
    
Location also supports regular expressions with <Location ~ "/regex/">. ;) –  joschi Feb 28 '10 at 12:04

How about something like:

RewriteRule ^.+/.+?/$ /platform.php

Note: I did not test this

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.