.htaccess not working..

Discussion in 'Apache' started by smrutik, Mar 19, 2009.

  1. #1
    hi,

    we have changed our hosting server.
    on the new server htaccess is not working,
    it gives 500 - internal server error.

    How I should make it working??

    thanks,
    Smruti.
     
    smrutik, Mar 19, 2009 IP
  2. Sogrom

    Sogrom Peon

    Messages:
    154
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    A "500 Internal Server Error" is a message much like the common "404 File Not Found" message. You get the latter message in your browser when you try to access a non-existent web page. You get the "500 Internal Server Error" message when you try to run a script with problems. It is one of the most uninformative error messages that can mean anything from an improper upload to a bug in the script.

    Im going to guess its a file permissions problem or if the site was moved by the new host it could be the mode in which the server transferred the files.

    1) Location

    Did you upload your scripts into the right place? This is not as obvious as it may seem. Some servers are configured to run CGI scripts anywhere. Others will only run it when it is installed in a particular directory. It is not just a matter of creating a "cgi-bin" directory - for example, some hosts configure the server so that it will run scripts only from a particular directory outside the web directory structure (for security reasons). Your web page will still call the script "/cgi-bin/script.pl" but the server maps it to the actual directory. You will have to upload it in the right directory, regardless of what your web page calls it. Find out such information from your web host's documentation.


    2) File Upload Mode

    Did you upload your script in the right mode? Different operating systems have different ways of representing the end of line character (eg Unix uses a line-feed, Windows uses a carriage-return and line-feed pair), it is important that you set the uploading method correctly, so that line-end translation is performed.

    Re-upload the script, this time making sure that it was uploaded in the right mode. Do not use any auto-detection options.

    3) File Permissions

    Did you change the permissions on your script so that it can be executed on your web server? In most cases, simply uploading the script to the server does not necessarily mean that it can run. On Unix web servers (like Linux, BSD, Solaris, etc), it is necessary to change the file permissions to indicate to the operating system that the file may be executed. If you have a Unix FTP client, set the permission ("chmod") of the file to 755, which allows the script to be executed by everybody. If you are using WS_FTP from Windows, right click the file that you've just uploaded and choose "chmod". You will be presented with a dialog box where you should check "Read, Write, Execute" for the owner, "Read, Execute" for the group and everyone else.

    4) Check your error logs.
     
    Sogrom, Mar 19, 2009 IP
  3. Tropp

    Tropp Well-Known Member

    Messages:
    108
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Without error logs and seeing your htaccess file, all you'll get is people making wild guesses
     
    Tropp, Mar 19, 2009 IP
  4. smrutik

    smrutik Guest

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    hii,

    1. I tried keeping my code inside the cgi-bin directory. But it did not work.
    (I have a sub-domain where i have kept the code inside the cgi/bin folder of the sub-domain)

    2. which File Upload Mode should be selected?

    3. Kept 755 file permissions for the required folder

    4. Error log does not show any information except the page on which error occurred and its reference.

    Pls guide.
     
    smrutik, Mar 21, 2009 IP
  5. rathin

    rathin Peon

    Messages:
    1,377
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #5
    u haveing cgi enabled?
     
    rathin, Mar 21, 2009 IP
  6. Sogrom

    Sogrom Peon

    Messages:
    154
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    File Upload Mode = ASCII

    Text files, which includes most cgi files are uploaded in ASCII or text mode. Just about all other files should be uploaded in binary mode.
     
    Sogrom, Mar 22, 2009 IP
  7. smrutik

    smrutik Guest

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    hi,

    Now if i enable my .htaccess file, its not giving the 500 internal server error but for every link
    it shows the home page.

    pls guide.

    thanks.
     
    smrutik, Apr 1, 2009 IP
  8. Lpe04

    Lpe04 Peon

    Messages:
    579
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #8
    can you post the code?

    Cheers,
     
    Lpe04, Apr 1, 2009 IP
  9. smrutik

    smrutik Guest

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Hi,

    the problem is solved now.
    The links (where) to redirect were having parameters separated by '/'.
    When these were replaced like normal query string like 'abc.php?abc=1' it started working.
    (it was previously like abc.php/abc/1/' )

    But I have a query now, will this change affect SEO ranking? why the new server did not respond
    to my previous code?

    thanks,
    Smrutik.
     
    smrutik, Apr 8, 2009 IP