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 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.

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

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