Forum Moderators: phranque
I'm trying to redirect www. sites/pages to [domain.com...] (non-www.) I know this has been covered many times in this forum and I think I know the basics of what I need to do from this post:
[webmasterworld.com...]
The problem is that I can't even figure out how to get this file to open to edit it.
I've searched dozens of webpages trying to figure this out but I can't find a way to do it. I assume that I'm just not using the correct commands or something.
I've just recently moved to a VPS and the host says that I should be able to do this. He said to log into usr/local/apache/conf and I should be able to find it there. He told me that I could use the program Putty to do this.
So I start putty, direct it to the IP, enter name and PW and I get -bash-3.00# I don't know if this is good bad or not, but I enter usr/local/apache/conf/ and it says "usr/local/apache/conf: is a directory".
Then I entered /usr/local/apache/conf/httpd.conf
and got back /usr/local/apache/conf/httpd.conf: Permission denied
I contacted the host and he said to enter the command pica httpd.conf so I tried
-bash-3.00# /usr/local/apache/conf/ pico httpd.conf
which again gives me:
-bash: /usr/local/apache/conf/: is a directory
I don't want to spend forever trying to figure this out on my own and I realize that I'm probably in over my head. I'll hire someone if I need to but theoretically this should be something easy to do.
Again, I've searched all over the net trying to find a solution and I can't. I've anyone here has any tips I appreciate it!
Thanks!
From within the bash you now may use an editor (like pico) to open the the file:
`pico /usr/local/apache/conf/httpd.conf`
Before starting that editor, make sure to make yourself familiar how to use it (and how to safely exit and quit).
After having changed the httpd config file, you need to reload or restart the apache server.
However, if you are unsure about basics like this, you should be very careful when changing config files on your system. It is very easy to screw things up.
While you probably won't need to hire someone to make just this small change in a config text file, you should think about hiring a system administrator to take care of all the other basic stuff.
Kind regards,
R.
If you want to try out at least opening the file, you can start by changing into the correct directory:
cd /usr/local/apache/conf/ (cd means change directory)
First step is to make a backup of the file you want to edit:
cp httpd.conf httpd.conf.bak (cp means copy)
Then use the pico program (pico is a good simple text editor) to view the file:
pico httpd.conf Control + O to save the file, Control + X to exit.
If you make a change, then you must restart Apache for it to take effect. The command can differ accross different versions, but usually it is:
apachectl restart If the restart fails, you can always revert back to your old version:
mv httpd.conf httpd.conf.broken
mv httpd.conf.bak httpd.conf
apachectl restart (mv means move, so in the above you use move to rename the broken httpd.conf file and then move the .bak file to replace the broken one)
Here's a few basic guides about the command line:
[infohost.nmt.edu...]
[andrsn.stanford.edu...]
I would strongly recommend getting an old machine (it doesn't need to be powerful or modern) and installing Linux on it for testing. Ideally you should install the same distribution of Linux as your hosting company as each distro can vary in subtle ways. In this way, you can get to know how Linux works without risking messing up your main server. It is useful too to have such a machine as a local test server!