php - mod_rewrite redirect to clean URLs -


i'm using mod_rewrite in .htaccess create following clean urls.

.htaccess

rewriteengine on rewriterule ^home$ /index.php [l] rewriterule ^groups$ /groups.php [l] rewriterule ^contact$ /contact.php [l] rewriterule ^personalise$ /personalise.php [l] rewriterule ^terms$ /terms.php [l] 

all works i've been trying original links redirect smooth links. example, if visits www.mydomain.com they'll redirected www.mydomain.com/home , likewise if trail domain index.php or other page name.

i've had @ few different rules don't seem work, i'm not familiar module. ideas appreciated!

i giving 2 of these new rules:

  1. to redirect index.php /home
  2. to remove .php extension

your full .htaccess:

rewriteengine on  rewritecond %{the_request} \s/+index\.php[\s?] [nc] rewriterule ^ /home [r=301,l,ne]  rewritecond %{the_request} \s/+(.*?)\.php[\s?] [nc] rewriterule ^ /%1 [r=301,l,ne]  rewriterule ^home$ /index.php [l] rewriterule ^groups$ /groups.php [l] rewriterule ^contact$ /contact.php [l] rewriterule ^personalise$ /personalise.php [l] rewriterule ^terms$ /terms.php [l] 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -