Jump to:

4873 Posts in 7260 Topics by 1471 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » .htaccess mod_rewrite 500 server error

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

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

Page: 1
Go to End
Author Topic: 1281 Views
  • Petr
    Avatar
    Community Member
    1 Post

    .htaccess mod_rewrite 500 server error Link to this post

    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?

  • Plato
    Avatar
    Community Member
    26 Posts

    Re: .htaccess mod_rewrite 500 server error Link to this post

    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.

    1281 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.