.htaccess redirect all extension to php
Try these in your .htaccess file and please check if rewrite engine is on in server and there is mod_rewrite.c module is there in main apache conf file that is httpd.conf.
1. RewriteRule ^about$ about.php [L] OR 2. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php
Hope these work fine.
OR otherwise this is another option with all description:
Apache Rewrite Rules Options +FollowSymLinks RewriteEngine On RewriteBase /
Add trailing slash to url
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.[a-zA-Z0-9]{1,5}|/|#(.))$ RewriteRule ^(.)$ $1/ [R=301,L]
Remove .php-extension from url
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^([^.]+)/$ $1.php
End of Apache Rewrite Rules
Things I guess you want to know:
This is for sites that don’t use a front-end-controller where all requests are forced through index.php. If you need that, you must replace the third block with your own.
The example is showed with .php only. If you want to use it with .html for example, you must copy/paste the third block and replace “.php” on line (1,) 3 and 4 with “.html” (unless someone has a neat way of doing it?)
The content of “example.com/something/” could be served from either “example.com/something.php” or “example.com/something/index.php”.
To link to other pages, just href=”/some/thing/” or href=”//example.com/some/thing/”.
With .css and .js you want to href=”/style.css” or href=”/folder1/style.css”. Else if you href=”style.css” from “example.com/folder2/file.php” it’ll look at “example.com/folder2/style.css”.
Note: There is http:// in-front of all all example.com.