• # July 28, 2009 at 11:56 pm

    Does anyone know how to remove the .html or .php extensions from appearing in the URL? My example would be like (before) http://www.testing/remove.html to (after) http://www.testing/remove
    I searched Chris’s site and this forum, I could not find an answer, unless I overlooked it. I did not know if anyone out here was familiar with this or not? I researched the web, I know this requires coding in the .htaccess.txt file. However, some of the example codes I tried never worked for some reason.

    One example code:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME}!-d
    RewriteCond %{REQUEST_FILENAME}!-f
    RewriteRule ^([^.]+).php$ $1 [L]

    Two of my PHP books, do not even mention this?

    Any help would be appreciated!


    # July 29, 2009 at 2:25 am

    This reply has been reported for inappropriate content.

    have you tried looking up for pretty URLs?

    I have had a very quick look for you, but it only deals with the file name e.g. test/test.php = test/ not test/test

    but to be honest it might be confusing to do it your way (for the reader I mean)

    # July 29, 2009 at 3:52 am

    This reply has been reported for inappropriate content.

    I just searched "htaccess remove file extension" and this was the first thing that popped up

    # July 29, 2009 at 7:56 am

    Just to make sure the obvious is covered here….

    You could create a directory called "remove" in your root directory and put an index.html file inside of that and you’d have /remove/ working no problem.

    # July 29, 2009 at 10:48 am

    Chris, you know I did’nt even think about creating a directory. I will try that that. Thanks for the replies everyone!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.