This question already has an answer here:
I am trying to rewrite all my ".php" extension to "/" for example: www.example.com/about.php to www.example.com/about
I modified the httpd.conf file as follow.
<Directory "/var/www/example">
Options Indexes Includes FollowSymLinks IncludesNOEXEC
AllowOverride All
Allow from all
Order allow,deny
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
</Directory>
Now I can access www.example.com/about see the content but the page layout is broken as if missing css file. The front page (www.example.com) and pages with ".php" attached are still ok but the sub pages with "/" are having issuess with the layout.
For example: www.example.com/about.php is ok but www.example.com/about/ is having issue with the layout.
</div>
Either make all of your links absolute paths:
<img src="/path/to/image.jpg">
<script type="text/javascript" src="/path/to/script.js">
<link rel="stylesheet" href="/path/to/style.css" type="text/css">
etc.
Or add this to your page header:
<base href="/">