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

.htaccess mod_rewrite 500 server error


Go to End


2 Posts   4916 Views

Avatar
Petr

Community Member, 1 Post

22 February 2012 at 12:22am

Hello.

I have uploaded SS to my server and after trying to run /install.php I got 500 server error. I figured out quickly that the problem is in the default .htaccess file namely in the mod_rewrite part of it:

<IfModule mod_rewrite.c>
              SetEnv HTTP_MOD_REWRITE On
	RewriteEngine On

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

Commenting the SetEnv line:

#        SetEnv HTTP_MOD_REWRITE On

fixed the problem but I still got error during the installation process:
Friendly URLs are not working. This is most likely because a rewrite module isn't configured correctly on your site. You may need to get your web host or server administrator to do this for you:

  • mod_rewrite or other rewrite module is enabled on your web server
  • AllowOverride All is set for the directory where SilverStripe is installed
.

More over after that the 500 server error appeared again!

It took me quiet a long time to find out the install.php script changes .htaccess file back to the default and I had to comment the SetEnv line in install.php createHtaccess() function. This solved the problem.

I am posting this here for two reasons

  • because it may help someone with the simmilar problem.
  • Don't you think that the automatic initialization of the .htaccess during the installation process is kind of a bug? The default .htaccess is present in the downloaded SS package so why to rewrite it again during installation?

Avatar
Plato Creative

Community Member, 26 Posts

23 February 2012 at 12:09pm

the .htaccess is rewritten to update the RewriteBase rule.
For sites sitting in domain roots, this isn't an issue. However if you ever run SS out of a subdirectory, then it needs to be updated.

I've never had an issue with the setenv line before.
Infact I hadn't even realise it'd been added.