I am currently using the following rewrite provided by dklynn. It works great.
RewriteEngine On
RewriteRule ^/?([a-zA-Z0-9_-]+)$ /rewrite.php?param1=$1 [L]
RewriteRule ^/?([a-zA-Z0-9_-]+)(/([a-zA-Z0-9_-]+))$ rewrite.php?param1=$1¶m2=$3 [L]
RewriteRule ^/?([a-zA-Z0-9_-]+)(/([a-zA-Z0-9_-]+))?(/([a-zA-Z0-9_-]+))?$ rewrite.php?param1=$1¶m2=$3¶m3=$5 [L]
rewrite.php functions as the controller (directs requests to various files depending on the resource requested) for anything that requires rewriting. However, I want to make a change. Instead of using rewrite.php as a controller, I want to use another file above public_html.
My server directory structure is like this:
/home/username/public_html/addon_domain
The current htaccess file resides in the /addon_domain folder and rewrites to /addon_domain/rewrite.php.
I keep my code above public_html. I would like to redirect to /home/username/scripts/controller.php
Is it possible to rewrite to a file above public_html and how would I go about doing that? I’ve looked for an answer for over an hour now and cannot seem to get anything to work. Everything is relative to the document root where htaccess resides and I cannot find a way to go above it. Maybe I am missing something simple?
Thanks.