views:

20

answers:

1

I have tried to rewrite my url so that it removes php extention and adds trailing slash.

I can access the page this way now.. lovelakedistrict.com/lake-district-cottages/

but i can also access it via this way:

lovelakedistrict.com/lake-district-cottages.php

how can I remove the php extention for good. this my htaccess

Options +FollowSymlinks
Options +Indexes
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]




RewriteRule ^lake-district-cottages/cottages/([0-9]) lake-district-cottages.php?cottages=$1
A: 
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /[^.#?\ ]+\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^([^.]+)\.php$ /$1 [R=301,L]
Lekensteyn
perfect thank you very much.
AJFMEDIA
If you find an answer helpful, click on the arrow up. If this your question (as in this case), and it's the best answer, click on "Accept question". Please don't create a second question within the same scope if nobody replies on [the first](http://stackoverflow.com/questions/3577463/regex-htaccess-mod-rewrite-cleanurl-problem-help-please).
Lekensteyn