How to make my url looks cool with htaccess
regulars question :P
Current URL
http://domain.com/index.php
http://domain.com/index.php?page=submit-hosting
http开发者_如何学Go://domain.com/index.php?page=popular-hosting
How write my .htaccess
to make current URL to be like this
When user type
http://domain.com/index.php
url will return tohttp://domain.com/
only withoutindex.php
And page with
$_GET['page']
to behttp://domain.com/submit-hosting/
Let me know :)
From Google I got
to remove index.php
or index.html
RewriteCond %{THE_REQUEST} \ /(.+/)?index\.(html?|php)(\?.*)?\ [NC]
RewriteRule ^(.+/)?index\.(html?|php)$ ./$1 [R=301,L]
to make end with slash
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]
RewriteCond %{REQUEST_URI} ^(/.*[^/])/?$
RewriteCond %{DOCUMENT_ROOT}%1.php -f
RewriteRule ^([^/]+)/?$ ./$1.php [QSA,L]
to make /page-name/
RewriteRule ^([^/]*)/$ ./index.php?page=$1 [QSA,L]
Any simple or better from this one?
精彩评论