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:
- to redirect
index.php
/home
- 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
Post a Comment