Mod Rewrite - Simple Question

Posted by bob on Stack Overflow See other posts from Stack Overflow or by bob
Published on 2009-05-13T08:59:24Z Indexed on 2010/05/09 20:08 UTC
Read the original article Hit count: 207

Filed under:
|

This is my current .htaccess

Options +FollowSymLinks
DirectoryIndex index.php

RewriteEngine On
RewriteBase /product/

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(.+)\.php$ ./$1/ [R=301,L]

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

RewriteRule ^contact/?$ ./contact.php [QSA,L]

Everything is working fine now..

  • /product/contact return to /product/contact/
  • /product/contact.php return to /product/contact/

Question..

  • How to make all my .php will be /contact/ /help/ /faq/
  • Now I should to add contact.php help.php faq.php to the htaccess
  • I tried to add RewriteRule ^(.*)/$ $1.php [QSA,L] but it will be return loop.

Let me know how to fix it ;)

© Stack Overflow or respective owner

Related posts about mod-rewrite

Related posts about url-rewriting