Chaining rewrite rules from directory to directory ...
Hello all. I'm looking for the appropriate way to chain/link rewrite rules from one directory to another. So, suppose I have the following directory structure:
I would like to place a rewrite rule in /home/jon/public_html/.htaccess which rewrites URLS to load from /home/jon/public_html/some_directory. From there, I need the request to also be handled by any rewrite rules that happen to appear in /home/jon/public_html/some_directory/.htaccess.
Currently, /home/jon/public_html/.htaccess looks something like this:
And /home/jon/public_html/some_directory/.htaccess looks something like this:
# SymLinks needs to be on ...
# Turn rewriting on ...
# Rewrite us into the correct directory.
# Change this as necessary.
RewriteRule ^(.+)$ some_directory/$1 [QSA]
Currently, when I make a request like http://localhost/~jon/something, I get a 404 like this:
# URL Rewriting
# set this to your project's visible directory
# add a line like this for every directory you wish to be
# served/parsed directory (not via index.php)
RewriteRule ^images/ - [L,QSA]
# all (most) pages should be served via index.php.
RewriteRule ^$ index.php [L,QSA]
RewriteRule ^/$ index.php [L,QSA]
RewriteRule ^(.+)/$ index.php?page=$1/index [L,QSA]
RewriteRule ^/([^.]+)$ index.php?page=$1 [L,QSA]
RewriteRule ^/(.+)\.([^.]*)$ index.php?page=$1&theme=$2 [L,QSA]
So, it's clear that the rewrite rules in /home/jon/public_html/some_directory/.htaccess aren't taking effect. Should by RewriteBase be different for that file? Or, is there a trick I need here to get this working?
The requested URL /~jon/some_directory/something was not found on this server.
I got a solution that fits my particular problem, bypassing the need for the request to be handled by multiple sets of rewrite rules. However, I think it would still be useful to know why my requests were not being processed by both sets of rules ...
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)