cancel
Showing results for 
Search instead for 
Did you mean: 

.htaccess & 404 pages

N/A

.htaccess & 404 pages

I'm trying to create a site specific 404 re-direct page, via a.htaccess file.

I've followed the instructions as I've seen 'em - except that I can't CHMOD the file to 644, it's defaulted to 0. I'm not given the opportunity to change the CHMOD on any file until I log out and in again on ftp voyager, and while that works fine for html files, I can't see the .htaccess file at all when i start up the programme again.

I now notice that my entire site is sufferring from an Internal Server Error 500!
5 REPLIES
N/A

.htaccess & 404 pages

If you log on using telnet, you can change to the relevant directory and issue a chmod command:


    telnet cgi.force9.net

    enter your username (as used for FTP to crofters/cgi) when prompted

    enter your password (as in FTP to crofters/cgi) when prompted


    cd <the directory containing your .htaccess file>

    ls -al (lists all contents of directory, showing file permissions)

    chmod 644 .htaccess (sets desired permissions on the .htaccess file -- you might wish to consider 604 rather than 644)

    ls -al .htaccess (lists the .htaccess file to check the permissions)

    If all OK, exit from telnet:

    exit


Remember, at any time, you can view all the contents of a directory, including "hidden" files (those starting with a ".") using:

ls -a or (for a long listing) ls -al
N/A

.htaccess & 404 pages

cheers. i think that might have worked...apart from I couldn't find the relevant directory in my main directory - as there was a list of thousands of other directories, most of which i'd never seen before in my life (sadbiker?!). so many, i couldn't spot which one might be the one i needed - whatever i guessed at didnt seem to work. ended up having to delete the entire site & reload it, hey ho.

should the .htaccess go in the cgi-bin then? the docs i read implied it should go straight into the main folders.
N/A

.htaccess & 404 pages

Quote

should the .htaccess go in the cgi-bin then? the docs i read implied it should go straight into the main folders.


No. I simply assumed you were doing something on the cgi machine (crofters) because you had posted in the CGI Forum rather than "Websites, Links and Everything Internet"!
N/A

.htaccess & 404 pages

a jolly reasonable assumption....tho i was just sticking it in here cos the other forum seems rather dodo like.
N/A

Using FTP to change File permissions

Hello again!

I've just realised that, because you're interested in changing permissions on the homepages.force9.net (ftp-proxy.force9.net) machine and not crofters (cgi), the telnet method I suggested is not helpful to you. As far as I'm aware the telnet daemon does not run on the homepages machine, so you will not be able to connect!

You can, however, use command-line ftp to change file permissions. A little complicated, but we'll get there! You need to log on to homepages.force9.net or to ftp-proxy.force9.net using ftp. Tonight "homepages" isn't working for me, so I'll show it for ftp-proxy.force9.net.

As is my convention here, I'll use blue text to show what you need to type and brown text to show what the machine (either your own local PC or the remote force9 server) sends to your display.

    >ftp ftp-proxy.force9.net
    Connected to ftp-proxy.force9.net.
    220 Force9 FTP-Proxy 2
    User (ftp-proxy.force9.netSadnone)):
    <your username>
    331-PLEASE NOTE: If you have a non-subscription account you
    331-will only be able to login to this ftp server if you are
    331-dialled into our network.
    331-
    331-ALSO: If you upload a file whose size would cause you to
    331-exceed your allocated disk quota, it will be automatically
    331-removed.
    331-
    331-Force9 FTP Server #1 ready
    331 Password required for <your username>.
    Password:
    <enter your password>
    230 User <your username> logged in.
    ftp>


    You're now logged in. Now use the "cd" command to change directory to the directory in which your .htaccess file resides:

    ftp> cd htdocs/......
    250 CWD command successful.
    ftp>


    Files starting with a "." are "hidden" files in Unix-like operating systems. They may be listed using the ls command with the -a option ("list all")

    ftp> ls -al
    200 PORT command successful
    150 Opening ASCII mode data connection for file list
    drwxr-xr-x 2 <owner> <group> 4096 Jul 17 23:01 .
    drwxr-xr-x 14 <owner> <group> 4096 Jul 17 22:55 ..
    -rw-rw---- 1 <owner> <group> 19809 Jul 17 22:56 .htaccess
    <etc>
    226 Transfer complete.
    ftp: 753 bytes received in 0.02Seconds 47.06Kbytes/sec.
    ftp>


    Now you've reached the correct directory, and you've checked to ensure the file you wish to change is in the directory, you can issue the all important command:

    ftp> quote site chmod 644 .htaccess
    200 SITE CHMOD command successful.
    ftp>


    You can check the permissions thus:

    ftp> dir .htaccess
    200 PORT command successful
    150 Opening ASCII mode data connection for file list
    -rw-r--r-- 1 <owner> <group> 19809 Jul 17 22:56 .htaccess
    226 Transfer complete.
    ftp: 66 bytes received in 0.00Seconds 66000.00Kbytes/sec.
    ftp>


    If you're happy, quit out of ftp:

    ftp> quit
    221 Goodbye.

    >


A word about "quote site chmod..."

  • The chmod part onwards is pretty much like the standard "change file mode" command for changing permissions on a Unix-like operating system.

  • "quote" is telling your local PC's FTP client to send what follows ("site...") to the server without attempting to interpret the command locally -- you are "quoting" the command. Windows also has the command "literal" which does the same thing -- send the command literally to the server.

  • "site" allows for site-specific commands to be incorporated in the FTP server implementation. On an IBM mainframe, for example, you'll find all sorts of wonderful things implemented as site commands to enable you to control mainframe-type things such as the blocksize, dataset organisation, logical record length, record format and how much space to allocate for any data sets which may be created when you "put" a new file. Try "remotehelp site" or "quote help site" to see what is provided in the Linux implementations used by Force9.


Hope that's helpful.

task.force9