0

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

2 Answers 2

1

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

2
  • 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. Commented Feb 28, 2010 at 11:52
  • Location also supports regular expressions with <Location ~ "/regex/">. ;) Commented Feb 28, 2010 at 12:04
0

How about something like:

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

Note: I did not test this

You must log in to answer this question.