#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Location
    Vancouver, WA, USA
    Posts
    398
    Rep Power
    189

    Preventing loop using mod_rewrite


    My customer wants to rewrite
    /XXXXX/ to access XXXXX.php

    But at the same time, if XXXXX.php is pulled up, he wants to redirect to /XXXXX/ to hide the .php

    Current attempt:

    Code:
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(\.php|\.css|\.html|\.htm|\.jpeg|\.jpg|\.png|\.js|\.ico)$
    RewriteRule ^(.*) /$1.php [L]
    
    RewriteCond %{REQUEST_URI} (\.php)$
    RewriteRule ^(.*)\.php $1 [R=301]
    Any advice for the weary?
    Last edited by ttremain; September 25th, 2013 at 08:38 PM.
    Thomas Tremain

IMN logo majestic logo threadwatch logo seochat tools logo