.htaccess redirect example.php and example.html to example/

Discussion in 'PHP' started by floryn_ro_bo, Mar 15, 2011.

  1. #1
    Hi,

    My old website have html pages. I redesign my website with php

    I allready have html pages indexed in google.
    Now I want to redirect old and new files to an url without extension.


    old url :example.html
    new url: example.php
    target url : example/

    I don't know how to do that. First I need to rewrite the url format from example.htm example.php to example/ and after that to make redirect?

    I need this for all website pages.


    Regards,
    Floryn
     
    floryn_ro_bo, Mar 15, 2011 IP
  2. Minimal Hank

    Minimal Hank Peon

    Messages:
    136
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteEngine On
    Options +FollowSymlinks
    
    RewriteRule ^example.(html|php)$ example/
    Code (markup):
     
    Minimal Hank, Mar 15, 2011 IP
  3. awood969

    awood969 Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    40
    #3
    I would just ever so slightly tweak that bottom line to read;

    RewriteRule ^example.(html|php)$ /example/

    Just purely to avoid any trouble.

    Andrew
     
    awood969, Mar 16, 2011 IP