Myo Han
Myo Han

Reputation: 21

symfony 1.4 and strange 403 forbidden error

We have dev server and production server and it happens only in production server.

When we access the site with http://[domain].com/index.php , it is working fine.

But if we access with slash at the end http://[domain].com/index.php/ , it shows 403 forbidden error.

The strange thing is, it also shows 403 forbidden error when there is /xxx.php/ or /xxx.asp/ or /xxx.js/. It seems it doesn't redirect to index.php in these cases.

If we access like /abc/ or /abc.a/ or etc, it redirect to index.php and shows symfony 404 error which is correct.

Anyone has experience this situation?

Upvotes: 2

Views: 1015

Answers (2)

Arun Killu
Arun Killu

Reputation: 14263

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

place it in your .htaccess file root folder.

Upvotes: 1

pankar
pankar

Reputation: 1701

Have you tried to modify your .htaccess file in your web root? i.e add the following rule:

RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]

This way the URLs ending with the trailing slash will be normalized as if the didn't have it

Upvotes: 0

Related Questions