.htaccess - 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://domain.com/index.php?page=popular-hosting 

how write .htaccess make current url this

  1. when user type http://domain.com/index.php url return http://domain.com/ without index.php

  2. and page with$_get['page'] http://domain.com/submit-hosting/

let me know :)

from google 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 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 one?


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -