• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

remove .php extension in url

Johnson

i love c&y
NLC
using .htaccess how would i go about removing the .php from the url, so for example url.com/main.php would be url.com/main
 
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}!-d
RewriteCond %{REQUEST_FILENAME}!-f
RewriteRule ^([^.]+)\.php$ $1 [L]
 
Urm, vice versa on the rewrite rule Dynash, so the user browses to /main and gets /main.php
 
RewriteEngine On
RewriteRule ^([^.]+)/?$ $1.php?%{QUERY_STRING} [L]

I do believe. Or, to make it a tad more secure by only letting certain ones redirect:

RewriteEngine On
RewriteRule ^(index|contact|register|login|yougetthepicture)/?$ $1.php?%{QUERY_STRING} [L]
 
Back
Top