Rewriting requests to Bludit subdirectory

jonathanholvey
Ssr. Bludit
Posts: 23
Joined: Mon May 22, 2017 10:15 pm

Edi wrote: Fri Aug 25, 2017 11:25 amWhy do you not set /bludit as root directory of the domain?
There are a couple of reasons I can think of for not changing the root directory. The first is that some shared webhosts don't allow their customers to change the root, especially for single website hosts, or the default domain on multi-website hosts. A common solution to this is to rewrite URLs to a subdirectory using mod_rewrite.

The second is that .htaccess configuration files that exist above the virtual host root do not have an effect. In my scenario I need to configure the server with a separate .htaccess file to the one included with Bludit. Therefore Bludit must exist in a subdirectory of the web root.

I've found a solution by modifying the way that init.php and install.php define the variable $base. I added a condition to see if the current page URL starts with $base. Although this isn't a general solution for any rewrite rule, it works for what seems the most likely scenario, where URLs are rewritten to be relative to the web root.

Let me know what you think.
https://github.com/JonathanHolvey/bludi ... e0b71f25b6

Cheers,
Jon
Post Reply