1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Pages don't open without "www" or ".html"

Discussion in 'General Programming Chat' started by ninehigh, Nov 10, 2010.

  1. ninehigh

    ninehigh Newbie

    Joined:
    Sep 14, 2010
    Messages:
    21
    Likes Received:
    7
    Hey Guys,

    I recently backed up my websites and transferred them to a different server. Now that they're installed, I'm having a frustrating issues:

    All of the links on the site are in the format "domain(dot)com(slash)page" without ".html" after it.

    So now, none of the links on the website work, you have to go into the address bar and add ".html" to get the page to load.

    ALSO, it requires me to put the "www" before the domain name.

    Could someone please help? I REALLY don't want to have to go into all of the pages and change the links to add ".html" at the end!

    Thanks ​
     
  2. extremephp

    extremephp BANNED BANNED

    Joined:
    Oct 19, 2010
    Messages:
    1,293
    Likes Received:
    1,274
    You Missed The .htaccess file :)

    Get it, Reupload! 2 mins!

    Fixed!

    ~ExP~
     
    • Thanks Thanks x 1
  3. extremephp

    extremephp BANNED BANNED

    Joined:
    Oct 19, 2010
    Messages:
    1,293
    Likes Received:
    1,274
    Code:
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.html -f
    RewriteRule ^(.*)$ $1.html[COLOR=#FF0000]
     [/COLOR]RewriteCond %{HTTP_HOST} ^example.com
     RewriteRule (.*) http://www.example.com/$1 [R=301,L]
    
    Add this To Your htaccess file.

    Edit Example.com To your site :)

    Pages Will Open Fine :)

    ~ExP~
     
    • Thanks Thanks x 1
  4. ninehigh

    ninehigh Newbie

    Joined:
    Sep 14, 2010
    Messages:
    21
    Likes Received:
    7
    Thanks Guys. I made the changes below and replaced "example" with "maxmight" so now I'm able to get the homepages without typing www, but I'm still not getting the other pages to work.
    My HTaccess file was blank, so the only content is what's below.

    Also, I have hosting with hostgator. I have added multiple domains as "addon domains. Do I need to put this file in each sub-folder? that's how I have it now.

    Let me know, Thanks again.
     
  5. extremephp

    extremephp BANNED BANNED

    Joined:
    Oct 19, 2010
    Messages:
    1,293
    Likes Received:
    1,274
    Add me to Your Skype or Yahoo :)

    Its In My Profile :)

    ~ExP~