0

Hi,

i wanted to remove .php and place / but, it doesnt work. I get "500 Internal Server Error" message.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php 

# Forces a trailing slash to be added
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

How can i solve this problem?

Thanks

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by veledrom
0

I use this:

<Files ~ "^[^\.]+$">
       ForceType application/x-httpd-php
</Files>

Or this:

<Files ~ "^[^\.]+$">
       ForceType application/x-httpd-php5
</Files>

Depending on the server.

It will treat any file without extension as a php file.

0

Sorry Pritaeas, they didn't work. It doesn't generate any errors though.

I use Wampserver 2.0 with Apache 2.2.1 and PHP 5.3.0

Any other ideas?

0
RewriteEngine on

# Forces a trailing slash to be added
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$ //this line I don't know about. You might just want to check if a . exists as it would be easier. This is what the Internal Server error is from (I think)
RewriteRule (.*)$ /$1/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php [QSA,L]
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.