A Couple Of Beginner Questions

Discussion in 'Site & Server Administration' started by samo1215, Aug 9, 2009.

  1. #1
    I have a shared hosting plan with hostgator. This is my first time setting up a website so I have a few questions.

    First and foremost, I keep reading about things I can/need to do with a htaccess file. Is this something I just create in a text editor and place in my web directory or should I be able to access this somewhere in cPanel or the file manager?

    How do I configure my error pages like 404 for when a user enters a url on my domain that doesn't exist? Do I have to activate something in cPanel or put something in an htaccess file? Currently, if I go to: www.domain.com/madeupnonexistentpage.html, all I see is a blank page rather than an error screen.

    Also, I read for SEO purposes I want to direct all traffic to either domain.com or www.domain.com with a 301 direct. However, on hostgator (my hosting company) I read somewhere that it said I can't use a regular 301 direct as it will put my site in a permanent loop...so what do I need to do? Also, which is more preferable domain.com or www.domain.com

    I see in the file manager where I upload all of my pages that I have the option to compress files. I obviously want to optimize the performance of the site so would it be beneficial to compress any pages or images and if so, what format?

    Lastly, I built a small mobile site on a sub-domain that I want hand held devices to be redirected to when they browse to my main home page. I did some research and came across Wurfl but have no idea how to actually implement it.

    Any help would be greatly appreciated.
     
    samo1215, Aug 9, 2009 IP
  2. sarabvi

    sarabvi Peon

    Messages:
    127
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well if you are using an cPanel and any FTP Client to access your server its most likely that you will find .htaccess on your server. If not you you can make your own you can put any directive in this file and just make sure you save it as ".htaccess" and upload it to your sever via ftp or via file manager.

    To configure 404 error page or any other error page is very easy if you are using cPanel as your hosting control panel.
    Just login to your cPanel and scroll down to very bottom of page and there you will see "Error Pages" Icon under Advanced section. Just click it and you will have the options to set 401, 404 and other error pages to set with your own one.

    Well if you are not using cPanel you can simply make any page you want to and just save it as 404.shtml and upload to your server's root. well you can put the following codes in your page if you want to.

    Referring URL: <!--#echo var="HTTP_REFERER" -->
    Vistor's IP: <!--#echo var="REMOTE_ADDR" -->
    Requested URL: <!--#echo var="REQUEST_URI" -->
    Server Name: <!--#echo var="HTTP_HOST" -->
    Vistor's Browser: <!--#echo var="HTTP_USER_AGENT" -->
    Redirect Status Code: <!--#echo var="REDIRECT_STATUS" -->

    hope this will help a bit.
     
    sarabvi, Aug 9, 2009 IP
  3. samo1215

    samo1215 Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    sarabvi, thanks for your help. Unfortunately, I'm still having some problems. I trying using cPanel and the filemanager to create error pages. In my public web folder I have a 404.shtml and a 400.shtml file. However, when I try to go to a page that doesn't exist I still see a blank screen instead of my error page. Is this an issue with hostgator or my hosting plan perhaps?
     
    samo1215, Aug 10, 2009 IP
  4. sarabvi

    sarabvi Peon

    Messages:
    127
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Well there is no issue with hostgator regarding custom error page, just read the info provided by hostgator themself.

    http://support.hostgator.com/articles/cpanel/custom-error-pages

    We can make error pages with .htaccess as well just do the followings.

    Create or edit the .htaccess file with the following info

    You will of course need to put a notfound.html file in the main web directory for the above directive to work.
     
    sarabvi, Aug 12, 2009 IP