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

Recommended Answers

All 5 Replies

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.

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?

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]

No guys don't work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.