Results 1 to 2 of 2

Thread: Chaining rewrite rules from directory to directory ...

  1. #1
    Join Date
    Jan 2007

    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:
    # SymLinks needs to be on ...
    Options +FollowSymLinks
    # Turn rewriting on ...
    RewriteEngine   On
    RewriteBase /~jon
    # Rewrite us into the correct directory.
    # Change this as necessary.
    RewriteRule ^(.+)$ some_directory/$1    [QSA]
    And /home/jon/public_html/some_directory/.htaccess looks something like this:
    # URL Rewriting
    RewriteEngine   On
    # set this to your project's visible directory
    RewriteBase     /~jon/some_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]
    Currently, when I make a request like http://localhost/~jon/something, I get a 404 like this:
    The requested URL /~jon/some_directory/something was not found on this server.
    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?


  2. #2
    Join Date
    Jan 2007
    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 ...

    ... Anyone?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles