Forum Moderators: phranque
\
\page1.php
\news\page1.php
\template\page1.php
\template\news\page1.php
\userA\index.php
Extrapolate page#.php to dozens of pages. There are also other subdirectories other than \news with pages in them.
There is 100+ of \user? directories, and the only file in any \user? subdirectory is index.php
\template is a duplicate copy of the files/dirs. in the root (with some code changes)
http:/www.example.com/page1.php
http:/www.example.com/news/page1.php
http:/www.example.com/userA/index.php
http:/www.example.com/userA/page1.php
http:/www.example.com/userA/news/page1.php
RewriteCond %{DOCUMENT_ROOT}/$1/$2 !-f
RewriteCond %{DOCUMENT_ROOT}/$1/$2 !-d
RewriteCond %{DOCUMENT_ROOT}/template/$2 -f
RewriteRule ^([^/]+)/(.*)$ template/$2 [L]
#RewriteCond %{DOCUMENT_ROOT}/phmc/$1/$2/$3 !-f
#RewriteCond %{DOCUMENT_ROOT}/phmc/$1/$2/$3 !-d
#RewriteCond %{DOCUMENT_ROOT}/phmc/LO-template/$2/$3 -f
#RewriteRule ^([^/]+)/(.*)$ LO-template/$2 [L]
#RewriteCond %{DOCUMENT_ROOT}/phmc/$1/$2/$3 !-f
#RewriteCond %{DOCUMENT_ROOT}/phmc/$1/$2/$3 !-d
#RewriteCond %{DOCUMENT_ROOT}/phmc/LO-template/$2/$3 -f
#RewriteRule ^([^/]+)/([^/]+)/(.*) $ LO-template/$2/$3 [L] [edited by: incrediBILL at 11:22 pm (utc) on Jan 31, 2015]
[edit reason] added [CODE] formatter [/edit]
RewriteRule ^([^/]+)/([^/]+)/(.*) $ LO-template/$2/$3 [L] [edited by: lucy24 at 2:22 am (utc) on Jan 27, 2015]
RewriteCond %{DOCUMENT_ROOT}/phmc/LO-template/$2/$3 -f
RewriteCond %{REQUEST_URI} !(realfile|otherfile|thirdfile)
RewriteCond %{DOCUMENT_ROOT}/phmc/LO-template/$2 -f
RewriteCond %{DOCUMENT_ROOT}/phmc/$1/$2 !-f
RewriteCond %{DOCUMENT_ROOT}/phmc/$1/$2 !-d
RewriteRule ^([^/]+)/(.*)$ LO-template/$2 [L]
RewriteCond %{DOCUMENT_ROOT}/phmc/LO-template/$2/$3 -f
RewriteCond %{DOCUMENT_ROOT}/phmc/$1/$2/$3 !-f
RewriteCond %{DOCUMENT_ROOT}/phmc/$1/$2/$3 !-d
RewriteRule ^([^/]+)/([^/]+)/(.*) $ LO-template/$2/$3 [R]
multiple sites on the same hosting Account
if I go to http://www.example.com/userA/page1.php ... it's serving me http://www.example.com/LO-template/page1.php
RewriteCond %{DOCUMENT_ROOT}/phmc/lo-template/$2 -f
RewriteCond %{DOCUMENT_ROOT}/phmc/$1/$2 !-f
RewriteCond %{DOCUMENT_ROOT}/phmc/$1/$2 !-d
RewriteRule ^([^/]+)/(.*)$ /lo-template/$2 [L]
there was some issue with rules that force URL's to lowercase not behaving properly
If I understand correctly, since this rule does not reference specific extensioa and use (.*), it's capturing all the subdirectories I might throw at it (which is what I want). So my original rule was the only rule I needed.
RewriteCond %{REQUEST_URI} !^/(images|scripts|styles|subdir|otherdir|not-this-dir)
{ existing conditions here }
RewriteRule ^([^/]+)/((?:[^/]+)/)*[^./]+\.php) /lo-template/$2 [L]
<a href="section1.php">section1</a>. a string function within /lo-template/header.php which will check for a specific directory name in the URL (such as /news), or a more complex pattern match that looks for multiple directories, and if it sees them, add a relative path (../section1.php)