Jump to content

Removing .php in url


laPistola

Recommended Posts

Please see this thread for more details http://www.phpfreaks.com/forums/index.php?topic=234739.0;topicseen . I stumbled to it after a Google search.

 

Server: Apache/2

PHP: 5.3.6

PHP is ran as CGI.

 

Im trying to achieve a friendly URL for a blog im writting. ie the url looks like domain.com/blogs/article/1 where as blogs is the .php file

 

After a ForceType not working due to my host using CGI to run php files I found this solution and inserted it into my .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

 

which just made a redirection of domain.com/blogs/.php (it entered a / slash between blogs and .php)

 

So after reading the above linked to thread I changed my .htaccess file to:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*)/?$ $1.php [NC,L]

 

Which like the OP in that thread I received an 500 error. This is the log error:

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

 

Now I only really what this on the blogs.php file as the rest of the site is fairly static.

 

Any help would be great thank you.

Link to comment
https://forums.phpfreaks.com/topic/241102-removing-php-in-url/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.