I need an .htaccess placed in example.com/mydir/ that rewrite (without redirect) all url in /mydir/(.*) to /mydir/index.php?var=$1. If an url is to an exist path or file it's not relevant for me (it must be rewrite).

I can't use +FollowSymLinks, but SymLinksIfOwnerMatch.

Thanks.

link|improve this question
feedback

1 Answer

up vote 0 down vote accepted

I think you're looking for something like this:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule (.*) index.php?var=$1

First two RewriteCond's check to make sure the file or directory do not exist. Third checks to make sure you are not looping. It may need to be tweaked based on your server settings, but it should get you going.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown