Here's my .htaccess:

Options +FollowSymLinks  
Options +Indexes  
RewriteEngine On  
RewriteCond %{REQUEST_FILENAME} -d  
RewriteRule ([^/]+/.*) index.php?dir=%{REQUEST_URI}  

The htaccess lives in
I'm able to access and fine will get rewritten to check.orgOrprimary/index.php?dir=/primary/directory/ BUT stays within the url bar. This really is good.

The issue is after i attempt to access sub-sub sites. After I access it will get rewritten to index.php?dir=/primary/folder1/folder2/. This is good, however turns up within the address bar rather than keeping within the url bar. This is actually the problem.

I would like all sub sites, not only the direct kids of primary to help keep your directory within the url bar while spinning. The direct children do that fine, but any sites under that rewrite in ways where my get variables appear.

The objective of this rewrite is really I do not have to copy within an index.php file into every recently produced folder so copying the .htaccess into each folder defeats the reason.

You most likely want RewriteRule ([^/]+/.*) index.php?dir=%{REQUEST_URI} [QSA,L] (The L prevents mod rewrite from processing any more rules when the rule is effective) QSA appends any query string who have been passed in.


The problem would be that the server is spinning the URL with no slash (noticeably) because the URL using the slash, and as well as your rewrite rule included in that. The way in which around that might be to simply process the rule once the URL finishes having a slash eg:

RewriteRule ([^/]+/.*/$) index.php?dir=%{REQUEST_URI} [QSA,L]

By doing this it is going to do the rewrite in 2 separate steps:

  1. Add the slash noticeably.
  2. Rewrite making use of your rule to index.php

Rather than:

  1. Add the slash and rewrite to index.php noticeably.

I'll add the answer I discovered while testing mootinator's solution.

Rather than connecting to

connect to (Range from the slash!)

Redirection will effectively redirect to

stays within the url bar.

It is a somewhat hackish solution however it should work all right.