Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: getting rid of the ".html" extenstion on my webpage

  1. #1

    Default getting rid of the ".html" extenstion on my webpage

    If my webpage is hosted by hostmonster what is the easiest way to get rid of the ".html" extensions that my web pages currently have.

    I have been told to access the ".htaccess" file which I can't find or implement a "mod_rewrite" over the files. To clarify I want this to work on all pages so that even a new page that is built out it can be accessed and won't show the ".html" at the end of it.

    Any guidance on how to do this through a hostmonster account would be greatly appreciated.

    Thanks for the help!

  2. #2

    Default

    When you log into CPanel, click on File Manager.

    In the box that comes up, find and check the "Show hidden files (dot files)" option.

    Then, when your File Manager window comes up, move into your public_html directory.

    You should be able to find the .htaccess residing in that directory. If you don't find it there, you can simply create it by clicking on the "New File" link in the top left of the page.

    From there, you should be able to search the forums here or Google for the code to put in the .htaccess file to remove the .html extension. I would tell you, but I am running behind for work this morning and I really don't know ... I would have to search for it myself ...

    ~regards, and welcome to the community
    He is no fool that gives what he cannot keep to gain what he cannot lose. - Jim Elliot
    4ChristMinistry.org - Web development tutorials and Community forum.
    Demos - Kicking the tires on some popular software.

  3. #3
    Join Date
    May 2008
    Location
    Bahamas, Jamaica
    Posts
    1,327

    Default

    Perhaps this might be helpful in getting the .htaccess statements you need. Just replace '.php' with '.html'.

  4. #4

    Default

    Thanks shadmego and Falcon1986 for the help. I was able to get it to work. One last question, and I apologize for the newbie website questions I have.

    I've noticed that on some websites they take webpages like these:

    http://www.mywebpage.com/sports
    http://www.mywebpage.com/music

    and I am assuming they are using a mod_rewrite to make them appear like this:

    http://sports.mywebpage.com/
    http://music.mywebpage.com/

    What are the advantages of having the page look like this?
    Does it help SEO out?
    Then lastly, how do you set something like this up on hostmonster?

    Thanks for the help!

  5. #5
    Join Date
    May 2008
    Location
    Bahamas, Jamaica
    Posts
    1,327

    Default

    Those are called subdomains and are physically stored in your root web directory as subdirectories. You can create them from within your cPanel. Sometimes you may have to use mod_rewrite to redirect subdirectories to subdomains so that search engines do not see them as duplicate content on two separate URLs. Search around the forum on how to do this.

    I do not believe that subdomains offer any SEO advantage over plain ol' subdirectories, but some websites like to utilize subdomains for better organization. Look at the tutsplus.com websites for example. They create tutorial websites for different aspects of design, but create separate websites focused on specific areas using subdomains.

    I utilize subdomains for performance purposes, which I have read about here. So far, calling for CSS, JS files and images from subdomains seems to improve things a bit (or at least that is what YSlow tells me!).

  6. #6

    Default

    Thanks again Falcon1986. The one last bump I am having (then I should be in a clear hopefully) . . .

    so I have my sub domains set-up and then work fine. Continuing with the example above they look like this:

    http://sports.mywebpage.com/
    http://music.mywebpage.com/

    so I added a page, let's call it "swimming.html" to the "sports" folder where the subdomain "http://sports.mywebpage.com/" points to . . .

    it shows up fine at:
    http://www.mywebpage.com/sports/swimming

    But returns a 404 error here:
    http://sports.mywebpage.com/swimming

    Do I still need a mod_rewrite rule in my .htacess file to get that to show up?

    Thanks again for the help . . .

  7. #7

    Default

    did you actually create the subdomain using cpanel? its not a subdomain until you do that first. 404 error means it cannot find the page.

  8. #8

    Default

    Yeah these links work fine:

    http://www.mywebpage.com/sports/swimming
    http://sports.mywebpage.com/

    But returns a 404 error here:
    http://sports.mywebpage.com/swimming

    How do I get subdirectories showing up on the subdomain? The "swimming.html" file is located in the same place as the "index.html" file for the 'sports' subdomain page . . .

    Thanks for your help.

  9. #9

    Default

    Have you tried putting the whole file name, swimming.html? You might have something messed up in the .htaccess rules. That's all I can think of ....
    He is no fool that gives what he cannot keep to gain what he cannot lose. - Jim Elliot
    4ChristMinistry.org - Web development tutorials and Community forum.
    Demos - Kicking the tires on some popular software.

  10. #10
    Join Date
    May 2008
    Location
    Bahamas, Jamaica
    Posts
    1,327

    Default

    Place the following within your root web directory's .htaccess file.

    ~/public_html/.htaccess
    Code:
    Options +FolowSymLinks 
    RewriteEngine on
    
    # Redirects subdirectory to subdomain
    RewriteCond %{HTTP_HOST} ^(www\.)?yourdomain\.tld$
    RewriteRule ^folder/(.*) http://folder.yourdomain.tld/$1 [R=301,L]
    ...where references to 'yourdomain', 'tld' and 'folder' should be replaced with your own information.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
ankara escort