#1
  1. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Dec 2008
    Posts
    21
    Rep Power
    0

    replace php extension with slash and redirect


    Hi

    I want to remove extention of all .php pages with a /
    Code:
    http://localhost/myfolder/aboutus.php
    should get redirect to
    Code:
    http://localhost/myfolder/aboutus/
    I am using below code

    Code:
    options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !example.php
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^(.*)$ http://localhost/myfolder/$1/ [L,R=301]
    But it shows object not found error

    Thanks
    Vineet
    Last edited by vinpkl; May 2nd, 2015 at 10:44 AM.
  2. #2
  3. Just a Photographer
    SEO Chat Adventurer (500 - 999 posts)

    Join Date
    May 2011
    Location
    Atwater, CA
    Posts
    865
    Rep Power
    1767
    Have you tried something like this?
    How to remove .php, .html, .htm extensions with .htaccess

    Code:
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+)/$ $1.php
    RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
    RewriteRule (.*)$ /$1/ [R=301,L]

    Comments on this post

    • Will-O-The-Wisp agrees
    - Mike

    Jack of all trades, master of none.

Similar Threads

  1. Difference between extension URL and w/o extension URL
    By hetalpatel33 in forum Google Optimization
    Replies: 1
    Last Post: Jun 5th, 2009, 12:06 PM
  2. SEO extension For All SEOs
    By vreelmistee in forum SEO Help (General Chat)
    Replies: 5
    Last Post: Jan 23rd, 2008, 08:29 AM
  3. .org or .us extension for SEO?
    By primeheadlines in forum Search Engine Optimization
    Replies: 9
    Last Post: Aug 26th, 2006, 03:36 PM
  4. Replies: 9
    Last Post: Oct 27th, 2005, 09:48 AM

IMN logo majestic logo threadwatch logo seochat tools logo