I had a mod_rewrite problem with my ss-web-site that resides on a shared Apache-host.
When installing SS in a subfolder like /<my-website>/silverstripe/ SS did not work at all.
When installing SS without subfolder like /<my-website>/ SS did work more or less for short URLs like http://<my-website>/admin.
With long URLs that use many /Parameters/ like an Ajax-Request that loads the Image-Uploading-Form into a StaffPage-Image-Tag of the CMS, I got JS-errors and the Page-Not-Found-Page was loaded in place of the requested form.
By comparing this with a properly working SS-installation on a Wampserver I found that it had to do with the way that Apache (Php?) delivers some $_SERVER-fields that SS evaluates on every request (both installations in subfolder /silverstripe). Rewrite takes place in both installations but:
With Windows-Wamp-Apache-Server:
$_SERVER["SCRIPT_NAME"] shows the rewritten URL /silverstripe/sapphire/main.php
.
$_SERVER["ORIG_SCRIPT_NAME"] is not set
.
In main.php the $baseURL is calulated to: /silverstripe which is correct
.
With shared Apache-Host:
$_SERVER["SCRIPT_NAME"] shows /silverstripe/admin (not rewritten)
.
$_SERVER["ORIG_SCRIPT_NAME"] shows the rewritten URL /silverstripe/sapphire/main.php
.
In main.php the $baseURL is calulated to: / which is NOT correct
The following line in main.php fails to return the proper $baseURL
.
...
// Get the request URL
$baseURL = dirname(dirname($_SERVER["SCRIPT_NAME"]));
...
Now it works perfectly after inserting a bit of code
before the $baseURL-calculation line in sapphire/main.php
but I do not know wheter this is correct in every case.
...
if (isset($_SERVER["ORIG_SCRIPT_NAME"])) {
$_SERVER['SCRIPT_NAME']= $_SERVER["ORIG_SCRIPT_NAME"];
}
.
// Get the request URL
$baseURL = dirname(dirname($_SERVER["SCRIPT_NAME"]));
...
May be this can help