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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

[SOLVED] Issue with index.php on my website


Go to End


3 Posts   3452 Views

Avatar
buffy999

Community Member, 18 Posts

17 July 2014 at 11:28am

When i removed the index.php file in the root folder and did dev/build, but getting this error:
---------------
Forbidden

You don't have permission to access / on this server.
---------------

So i put it back, and it is working ok.

I've also tried to add this into _config.php

Director::setBaseURL('/');

It works, but when i click on the navigation to the pages, i get 404 error not found. So i've removed that again.

I've also tried to create .htaccess file in the root site since it doesn't have one, but it still not work, getting this error message:
-------------
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [no address given] 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.
Apache Server at dev.sutherlandesign.co.nz Port 80
---------------

My .htaccess file:

### SILVERSTRIPE START ###
<FilesMatch "\.(php|php3|php4|php5|phtml|inc)$">
    Deny from all
</FilesMatch>

<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>

ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html

<IfModule mod_alias.c>
   RedirectMatch 403 /silverstripe-cache(/|$)
</IfModule>

<IfModule mod_rewrite.c>
   SetEnv HTTP_MOD_REWRITE On
   RewriteEngine On
   RewriteBase /
   AllowOverride all
   RewriteCond %{REQUEST_URI} ^(.*)$
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(home|index\.php)/?$ / [L,R=301,NC]
</IfModule>
### SILVERSTRIPE END ### 

I've tried everything from the forums, still no result. Also i've contacted my host server, they don't have the developer to help me out, so i'm feeling a bit annoyed about that!

Anyone be able to help me out on this?? it would be greatly appreciated. :)

Thanks,
Kirsten

Avatar
thomas.paulson

Community Member, 107 Posts

17 July 2014 at 6:31pm

### 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>

# This denies access to all yml files, since developers might include sensitive
# information in them. See the docs for work-arounds to serve some yaml files
<Files *.yml>
Order allow,deny
Deny from all
</Files>

ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html

<IfModule mod_rewrite.c>
SetEnv HTTP_MOD_REWRITE On
RewriteEngine On
RewriteBase '/'

RewriteRule ^vendor(/|$) - [F,L,NC]
RewriteRule silverstripe-cache(/|$) - [F,L,NC]
RewriteRule composer\.(json|lock) - [F,L,NC]

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

try above htaccess, it is normally provided with silverstripe
sometime you have to adjust RewriteBase '/' with root folder like RewriteBase '/dev', then you can remove index.php

hope this help

Avatar
buffy999

Community Member, 18 Posts

20 July 2014 at 1:36pm

Thanks so much Thomas! Finally got it, it works!! :D

It was so simple, i just did what you suggested. You have made my day. :)