Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Installing SilverStripe /

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Moving to Live Server but i got an error about DirectorySlash...


Go to End


3 Posts   3196 Views

Avatar
Penalba

Community Member, 2 Posts

19 December 2008 at 8:31am

I have moved a SSsite to a live server, moving files and loading the database into the live server, but i got the next error:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@sandinismo.info and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

This is my log...

[Thu Dec 18 11:45:59 2008] [alert] [client x.x.x.x] /home/myuser/public_html/.htaccess: Invalid command 'DirectorySlash', perhaps mis-spelled or defined by a module not included in the server configuration
[Thu Dec 18 11:22:44 2008] [error] [client x.x.x.x] File does not exist: /home/myuser/public_html/404.shtml
[Thu Dec 18 11:22:44 2008] [error] [client x.x.x.x] File does not exist: /home/myuser/public_html/favicon.ico

Avatar
Penalba

Community Member, 2 Posts

19 December 2008 at 8:32am

Here is my .htaccess

### SILVERSTRIPE START ###
<IfModule mod_dir.c>
DirectorySlash Off
</IfModule>

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$

RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
### SILVERSTRIPE END ###

Avatar
HallMarc

Community Member, 3 Posts

4 February 2010 at 4:23am

Edited: 04/02/2010 4:24am

The DirectorySlash directive determines, whether mod_dir should fixup URLs pointing to a directory or not.

Typically if a user requests a resource without a trailing slash, which points to a directory, mod_dir redirects him to the same resource, but with trailing slash for some good reasons:

The user is finally requesting the canonical URL of the resource
mod_autoindex works correctly. Since it doesn't emit the path in the link, it would point to the wrong path.
DirectoryIndex will be evaluated only for directories requested with trailing slash.
Relative URL references inside html pages will work correctly.

This section of code is just making sure that this is turned off and is only available in Apache versions 2.0.51 and later which means if you are on a server with an older version of Apache this will result in a 500 server error.
To check which version of Apache your server is running create a php file with this code

<?php
phpinfo();
?> 

upload it to your hosting account, point your browser to it, look near the bottom under Enviroment and near the bottom of this section.
!Important! - Make sure you remove this file from your server when you are done.

Just remove these 3 lines from your .htaccess file and you will be good to go. No harm in removing them.

<IfModule mod_dir.c> 
DirectorySlash Off 
</IfModule>