+ Reply to Thread
Results 1 to 3 of 3

Thread: Removing .html from url

  1. #1
    painbringer_gr99 is offline x10Hosting Member painbringer_gr99 is an unknown quantity at this point
    Join Date
    Aug 2010
    Posts
    1

    Removing .html from url

    I've searched the web and read various tutorials on how to do this, but none seems to be working. I tested if htaccess is working by setting a password, and it works fine, but I really can't seem to find a way to remove file extensions from the url.

    So far, most of the tutorials claim this to be the solution, does my .htaccess file need to have anything else? Or just that? And if so, why isn't it working.

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.html -f
    RewriteRule ^([^/]+)/$ $1.html

    Can anyone supply me with the full code?

    Thanks for your time.

  2. #2
    patriotseminar72 is offline x10Hosting Member patriotseminar72 is an unknown quantity at this point
    Join Date
    Aug 2010
    Posts
    20

    Re: Removing .html from url

    Quote Originally Posted by painbringer_gr99 View Post
    I've searched the web and read various tutorials on how to do this, but none seems to be working. I tested if htaccess is working by setting a password, and it works fine, but I really can't seem to find a way to remove file extensions from the url.

    So far, most of the tutorials claim this to be the solution, does my .htaccess file need to have anything else? Or just that? And if so, why isn't it working.

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.html -f
    RewriteRule ^([^/]+)/$ $1.html

    Can anyone supply me with the full code?

    Thanks for your time.
    You could simply put the html file into a folder of the same name. Then rename the html file to index.html and point your links to the file
    So something like http://yourdomain.com/games.html would go to http://yourdomain.com/games/index.html but it would work also as http://yourdomain.com/games/

    Also, I recommend taking a look at this: http://corz.org/serv/tricks/htaccess2.php
    But, as far as I know the htaaccess. trick does not work correctly for what you want.

    Out of curiosity, why do you want to do this?
    Last edited by patriotseminar72; 08-15-2010 at 04:46 PM.

  3. #3
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Removing .html from url

    The server configuration on X10 currently requires that you set RewriteBase. In your root .htaccess, it would be:
    Code:
    RewriteBase /
    A simpler alternative to rewrite-based extensionless (aka clean) URLs is to use content negotiation:
    Code:
    Options +MultiViews
    All of this has been covered many times on these very forums.
    Last edited by misson; 08-15-2010 at 05:01 PM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Similar Threads

  1. Removing add on domains
    By djmatt in forum Free Hosting
    Replies: 4
    Last Post: 05-08-2010, 11:25 PM
  2. Removing account
    By peteabk in forum Free Hosting
    Replies: 1
    Last Post: 02-27-2010, 12:58 PM
  3. Removing Issues
    By wolflock in forum Graphics & Webdesign
    Replies: 0
    Last Post: 08-15-2009, 07:10 AM
  4. removing account
    By mountainbeast in forum Off Topic
    Replies: 3
    Last Post: 07-11-2009, 06:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers