21300 Posts in 5735 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 948 Views |
-
HTACCESS issue and 400 error

15 September 2010 at 5:27am Last edited: 15 September 2010 5:28am
Hey guys,
I'm having an .HTACCESS issue that I hope someone can help with. I have done a lot of Google searching but haven't found a solution that worked.It is a similar issue to this: http://silverstripe.org/archive/show/35627
Anyway, my SS site is in a subfolder on my main hosting path, called sssite in this example.
If I access the site with a slash after the name it works fine: http://www.website.com/sssite/, if I omit the slash then I get the 400 Bad Request error.
Here is my .HTACCESS file:
### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files><Files web.config>
Order deny,allow
Deny from all
</Files><IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>
### SILVERSTRIPE END ###If I change the line 5 up from the bottom to: RewriteCond %{REQUEST_URI} ^(.*)/$, then the site will come up fine with no slash, but then when I try to access pages within the site, i.e. http://www.website.com/sssite/page1, I get a "PAGE NOT FOUND" error.
I also played around with modifying the other .HTACCESS file in my root hosting to specifically add a slash when the sssite name is requested, but that didn't work either.
Does anyone have any ideas?
-
Re: HTACCESS issue and 400 error

15 September 2010 at 10:38am Last edited: 15 September 2010 10:38am
I solved the issue, and in case anyone else runs into it, here is my updated .HTACCESS file with added code in red:
Note: "sssite" would be replaced with the name of the folder that your site resides in.
### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files><Files web.config>
Order deny,allow
Deny from all
</Files><IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sssite
RewriteCond %{REQUEST_URI} sssite$
RewriteRule (.*) $1/ [L]
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>
### SILVERSTRIPE END ###
| 948 Views | ||
|
Page:
1
|
Go to Top |

