301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It is very easy to implement and it should preserve your search engine rankings for that particular page.
If you have to change file names or move pages around, it’s the best option to preserve your rankings and incoming traffic. The code “301″ is interpreted as “moved permanently”.
Redirect to www
Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to www.domain.com
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)
What is Web Hosting
As peculiar as it may seem to most techies, many people don’t understand what web hosting is. Basically, web hosting is what allows the world to see your website. You can design, code, and place a website on your harddrive where nobody sees it.. or you can spend a few bucks a month and host it on a type of computer known as a Web Server. This allows you to share your masterpiece with the public. A web server sends out, or serves, the files (html/php pages, images, etc.) to the visitors web browser (FireFox, Internet Explorer, Opera, etc.).
Does it matter which web host you choose?
Choosing your web host is one of the most important decisions you will make regarding your website. Subpar web hosting service can ruin your websites growth, traffic statistics, and mostly importantly, the visitors opinion of your website. Some web hosts promise the moon and can barely get off the ground. These companies are usually oversellers who cram as many websites on each server as possible. Often, they may not even own the server they’re selling space on. More often than not, this results in extremely poor performance. If the web server your website is hosted on can’t keep up with the load, all the websites hosted on that machine suffer.
The old saying, “you get what you pay for” is true almost everytime. Web hosting is no exception. Most people new to website hosting opt for the cheapest plan they can find at first. That is, until they actually experience the service! Their site loads slowly, responds sluggishly, and sometimes might not even load or go offline! Making the move to a quality web host is the first step to success for your website. Don’t spend a bunch of money developing your website only to skimp on the web hosting and ruin your visitors site experience. Who cares how cool the flash intro is if it takes 10 minutes to load?
So, what should I do?
We’ve been messing with servers and playing with the Apache web server for years now. We are tech guys, plain and simple. Just setting up a server and configuring it out the ying yang brings joy to our day. That’s why when we choose where to host our websites, we choose the best. We’ve partnered with several of the industry’s leading web hosts and stand behind their service. They offer professional solutions to all of your hosting needs. Need a quality affordable shared plan for your first website? ChaseHosting’s F1FTY.com has you covered for only $50 dollars a year. Talk about bang for your buck, 1 Terabyte of disk space and unlimited transfer! F1FTY servers are guaranteed to have less than 200 websites per server.
ChaseHosting also offers their Premium Shared Web Hosting plans for your website starting at a little over $80 a year. The professional plan boasts unmetered monthly transfer (no limits on bandwidth) and a terabyte of hard drive space. ChaseHosting’s premium plans are hosted on servers with less than 50 other websites.
The main goal of an eCommerce website may be to get visitors to buy a product, but this involves much more than just offering and finding the right product. Above all, customers have to have a feeling of trust and security in order to follow through and actually hand you the cash. This isn’t easy, but it certainly isn’t difficult either. Here are a few tips:
Share Other’s Experiences
Take time to collect testimonials from people who have purchased from you previously. Then, use customer photos and business seals like one from the Better Business Bureau with these testimonials to help other web visitors see the value and benefits you have to offer. Just be sure they’re in prominent areas of your site.
Make It Easy To Contact You
A contact page can be a company’s greatest ally when it comes to inspiring trust. After all, if something goes wrong and the customer knows they can contact you to look after it, they have nothing to worry about. Therefore, be sure to have a completed contact page and demonstrate that the customer is important to you.
Use an SSL Certificate
With so many criminals online, sending important information like credit card numbers is a scary prospect. This is where a Secure Sockets Layer (SSL) Certificate can really help. This is a method of sending data over a secure network. With this certificate, the user knows any sensitive information they share with you is encrypted and safe.
Web hosting from FatCow comes with a ShopSite online store so you can accept credit cards and integrate with PayPal as well. Visit FatCow now to find out more about their QuickSSL Premium Certificate and how it can help you inspire trust in website visitors. It’s safe and easy, plus you have nothing to lose!
Online, it is crucial for your visitors to know that the connection is secure. To encrypt the connection to your website, SSL certificates are commonly used to establish a secure connection. Webmasters may buy SSL certificates to secure their website from web hosting companies who sell offerings from premium vendors such as GeoTrust, Verisign, and others. Apache recommends Web Host With Us for buying SSL certificates.
Setup SSL Tutorial teaches you how to generate and setup a SSL certificate.
Assuming you have apache and openssl installed, you would like to generate and setup an SSL certificate for a domain and generate a CSR.
First, Generate the RSA & CSR (Signing Request)
[root@chevelle root]# cd /etc/httpd/conf/ssl.key
Generate the RSA without a passphrase: Generating a RSA private key without a passphrase (I recommended this, otherwise when apache restarts, you have to enter a passphrase which can leave the server offline until someone inputs the passphrase)
[root@chevelle /etc/httpd/conf/ssl.key]# openssl genrsa -out yourdomain.key 1024
Or, with a passphrase: Generating a RSA private key with a passphrase. You will be prompted to enter a passphrase right after you hit enter.
[root@chevelle/etc/httpd/conf/ssl.key]# openssl genrsa -des3 -out yourdomain.key 1024
You should generally NOT generate the RSA private key with a passphrase if you have scripts that restart apache automatically in case of a crash or otherwise. If there is a passphrase, Apache will just sit there and wait for the script to input the passphrase which means downtime, and downtime usually equals bad.
You will be asked to enter your Common Name, Organization, Organization Unit, City or Locality, State or Province and Country.
Do not enter these characters ‘< > ~ ! @ # $ % ^ * / ( ) ?.,&’ because they will not be accepted.
Common Name: the domain for the web server (e.g. MYdomain.com)
Organization: the name of your organization (e.g. YUPAPA)
Organization Unit: the section of the organization (e.g. Sales)
City or Locality: the city where your organzation is located (e.g. Flanders)
State or Province: the state / province where your organzation is located (e.g New Jersey)
Country: the country where your organzation is located (e.g US)
You may be asked for an email address and a challenge password. I usually just hit enter.
Now you should have:
Be sure to always make a backup copy of your private key! If you lose it, you’ll have to purchase a new cert!
Now you need to submit your CSR to your provider and they will mail you the certificate. They usually also send you a confirmation email before the certificate is sent out. Now that you have the certificate..
Installing the Certificate for Apache
[root@chevelle root]# cd /etc/httpd/conf/ssl.crt
Copy the certificate that they mailed you to yourdomain.crt
Open your httpd.conf file and place the following to your virtualhost
- other config details-
OPTION 1 [root@chevelle /etc/httpd/conf/ssl.crt]# apachectl restart
OPTION 2 (using the sh script) [root@chevelle /etc/httpd/conf/ssl.crt]# /etc/rc.d/init.d/httpd restart
You may be asked to enter the passphrase IF you generated the RSA with a passphrase. If you do NOT want to be asked for a passphrase when restarting apache, re-generate your RSA key file.
[root@chevelle /etc/httpd/conf/ssl.crt]# cd ../ssl.key
[root@chevelle /etc/httpd/conf/ssl.key]# mv yourdomain.key yourdomain.key.has-passphrase
[root@chevelle /etc/httpd/conf/ssl.key]# openssl rsa -in yourdomain.key.has-passphrase -out yourdomain.key
And then restart apache again
[root@chevelle /etc/httpd/conf/ssl.crt]# /etc/rc.d/init.d/httpd restart
Now you should be able to access https://yourdomain.com
If you’re looking for a good developmental server for your work, or just for personal use, what better place than your workstation? It eliminates the need for uploading your work to a remote server and allows you to run your scripts and test your website in a server environment. You can even set it up to be accessible to the public, password protected, or invisible behind your firewall.
Nowadays, it is easier than ever to get a complete web server setup on Windows. WAMP is a popular package combining the popular web server Apache, MySQL Database server, and PHP scripting language. The install takes a few minutes and is super easy; if you can click Next, you’re good. With a couple quick tweaks to your router and httpd.conf file you are ready to serve files to the web. The below steps will get you up and running in minutes, let’s get started!
After agreeing to the WAMP license, select the destination location. Leave the default location as “c:wamp” and click Next:
Choose your shortcut options and click Next:
Review your installation destination is correct. Click Install and WAMP will begin the install process:
WAMP will extract and install itself. The process should only take a few seconds.
WAMP will prompt you to enter the SMTP server and email to be used by PHP to send emails. Leave the default SMTP value as “localhost”, put your email address in the Email field and click Next:
If you have Firefox installed, WAMP will ask you if you would like to use Firefox as the default browser with WAMP. This is a personal choice, so feel free to choose either “Yes” or “No.” I prefer to use Firefox for pretty much everythig so I click “Yes” and then click Next:
You will likely be prompted by Vista whether the Windows Firewall should allow or block the features of WAMP. You want to allow all of the features of WAMP, so click Unblock:
Congratulations, the installation process is complete. Yes, it was really that easy. Now click Finish and Launch WAMP now:
Open a browser and enter “127.0.0.1″ or “localhost” as the URL, and you will see a summary of the installation process:
There are a few more configuration changes you must make to use WAMP. Firstly, open a port on your router and allow it to forward requests to WAMP. This will allow you to connect to your WAMP server from outside your local area network.
You will need to learn what your local area network IP address is before opening a port on the router. In order to do this, open Command Prompt by going to Start – Run, and typing “cmd”. It will open up a command prompt window.
Once in Command Prompt, type ipconfig. This command will show you your network IP information, we are interested in the IPv4 address and Default Gateway of your Ethernet adapter Local Area Connection.
Your address will be different from the one displayed. Write the IPv4 address and Default Gateway down and close the Command Prompt.
You are at the point where you can open a port on our router and forward requests to WAMP. The firmware for routers is different, so the directions are different for every router. Connect to your router through the browser of your choice. Enter the Default Gateway address you wrote down above.
If you have a Linksys router enter http://192.168.1.1 into the URL bar. If you have a NETGEAR router enter http://192.168.0.1.
Once you are in your router’s control panel, you will have a location called something along the lines of “Port Range Forwarding.” You will want to create a new entry and call the application WAMP to easily identify the application that is using the port. Enter 80 for Start and End, choose Both for Protocol and enter your IPv4 address (my address was 192.168.1.123) you obtained form the Command Prompt as the IP Address. Choose Enable and click Save Settings:
You need to edit one more file before you will be able to access your documents from outside your local area network. Click the WAMP icon that has been added to the system tray, choose “Config files,” and select “httpd.conf”:
This will open httpd.conf in Notepad. You will need to edit the section called “Controls who can get stuff from this server.” Scroll down to this section (it’s a little less than half way through the file) and change the line that says “Deny from all” to “Allow from all” and resave the document:
Click the WAMP icon in the system tray and restart Apache:
Open a browser and navigate to “http://www.whatismyip.com” and find out what your IP address is. Now open a browser and enter “http://yourIPaddress” and you will be forwarded to your WAMP server whether you are inside or outside your local area network. Anything you put into your “c:wampwww” directory will be stored on your server. For example, if you copied all your pictures to “c:wampwwwpictures,” you will be able to navigate to “http://yourIPaddress/pictures” and all of your pictures will be available.
It may come in handy to know how to check the CPU temperature of a server over SSH from time to time. It is nice to know how to check the vitals of a system quickly and easily. Use the following command to check what the current temperature reading of the processor of your server is over a SSH session or via any other terminal window:
*The command may vary slightly depending on your system configuration. If you need help, ask in the comments are and other visitors or Apache.com staff may help answer your question.*
SSH is a necessary tool in any server admin’s arsenal. It is the main way you will be interacting with your servers whenever you are performing system tasks such as install, updates, etc. SSH allows you to remotely connect to your server and command it via the shell. Below is a list of commands you will use commonly while working with your server.
I prefer the popular SSH client Putty, but any SSH client will do.
Common SSH Commands or Linux Shell Commands, ls : list files/directories in a directory, comparable to dir in windows/dos. ls -al : shows all files (including ones that start with a period), directories, and details attributes for each file.
cd : change directory · · “cd /home/username/” will navigate to /home/username/ directory cd ~ : go to your home directory cd - : go to the last directory you were in cd .. : go up a directory cat : print file contents to the screen
cat filename.txt : cat the contents of filename.txt to your screen
chmod: changes file access permissions
The set of 3 go in this order from left to right:
USER – GROUP – EVERONE
0 = — No permission
1 = –X Execute only
2 = -W- Write only
3 = -WX Write and execute
4 = R– Read only
5 = R-X Read and execute
6 = RW- Read and write
7 = RWX Read, write and execute
chmod numberpermissions filename
chmod 000 : No one can access
chmod 644: Usually for HTML pages
chmod 755: Usually for CGI scripts
chown: changes file ownership permissions
The set of 2 go in this order from left to right:
USER – GROUP
chown root myfile.txt : Changes the owner of the file to root
chown root.root myfile.txt : Changes the owner and group of the file to root
tail : like cat, but only reads the end of the file tail /var/log/messages : see the last 20 (by default) lines of /var/log/messages tail -f /var/log/messages : watch the file continuously, while it’s being updated tail -200 /var/log/messages : print the last 200 lines of the file to the screen
more: like cat, but opens the file one screen at a time rather than all at once more /etc/userdomains : browse through the userdomains file. hit Spaceto go to the next page, q to quit
pico : friendly, easy to use file editor pico /home/burst/public_html/index.html : edit the index page for the user’s website.
File Editing with VI ssh commands vi : another editor, tons of features, harder to use at first than pico vi /home/burst/public_html/index.html : edit the index page for the user’s website.
Whie in the vi program you can use the following useful commands, you will need to hit SHIFT + : to go into command mode
:q! : This force quits the file without saving and exits vi
:w : This writes the file to disk, saves it
:wq : This saves the file to disk and exists vi
:LINENUMBER : EG :25 : Takes you to line 25 within the file
:$ : Takes you to the last line of the file
:0 : Takes you to the first line of the file
grep : looks for patterns in files grep root /etc/passwd : shows all matches of root in /etc/passwd grep -v root /etc/passwd : shows all lines that do not match root
ln : create’s “links” between files and directories ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf : Now you can edit /etc/httpd.conf rather than the original. changes will affect the orginal, however you can delete the link and it will not delete the original.
last : shows who logged in and when last -20 : shows only the last 20 logins last -20 -a : shows last 20 logins, with the hostname in the last field
w : shows who is currently logged in and where they are logged in from.
who : This also shows who is on the server in an shell.
netstat : shows all current network connections. netstat -an : shows all connections to the server, the source and destination ips and ports. netstat -rn : shows routing table for all ips bound to the server.
top : shows live system processes in a nice table, memory information, uptime and other useful info. This is excellent for managing your system processes, resources and ensure everything is working fine and your server isn’t bogged down. top then type Shift + M to sort by memory usage or Shift + P to sort by CPU usage
ps: ps is short for process status, which is similar to the top command. It’s used to show currently running processes and their PID.
A process ID is a unique number that identifies a process, with that you can kill or terminate a running program on your server (see kill command). ps U username: shows processes for a certain user ps aux : shows all system processes ps aux –forest : shows all system processes like the above but organizes in a hierarchy that’s very useful!
touch : create an empty file touch /home/burst/public_html/404.html : create an empty file called 404.html in the directory /home/burst/public_html/
file : attempts to guess what type of file a file is by looking at it’s content. file * : prints out a list of all files/directories in a directory
du : shows disk usage. du -sh : shows a summary, in human-readble form, of total disk space used in the current directory, including subdirectories. du -sh * : same thing, but for each file and directory. helpful when finding large files taking up space.
wc : word count wc -l filename.txt : tells how many lines are in filename.txt
cp : copy a file cp filename filename.backup : copies filename to filename.backup cp -a /home/burst/new_design/* /home/burst/public_html/ : copies all files, retaining permissions form one directory to another.
cp -av * ../newdir : Copies all files and directories recurrsively in the current directory INTO newdir
mv : Move a file command
mv oldfilename newfilename : Move a file or directory from oldfilename to newfilename
rm : delete a file rm filename.txt : deletes filename.txt, will more than likely ask if you really want to delete it rm -f filename.txt : deletes filename.txt, will not ask for confirmation before deleting. rm -rf tmp/ : recursively deletes the directory tmp, and all files in it, including subdirectories. BE VERY CAREFULL WITH THIS COMMAND!!!
TAR: Creating and Extracting .tar.gz and .tar files
tar -zxvf file.tar.gz : Extracts the file
tar -xvf file.tar : Extracts the file
tar -cf archive.tar contents/ : Takes everything from contents/ and puts it into archive.tar
gzip -d filename.gz : Decompress the file, extract it
ZIP Files: Extracting .zip files shell command
Firewall - iptables commands iptables -I INPUT -s IPADDRESSHERE -j DROP : This command stops any connections from the IP address
iptables -L : List all rules in iptables
iptables -F : Flushes all iptables rules (clears the firewall)
iptables –save : Saves the currenty ruleset in memory to disk
service iptables restart : Restarts iptables
Apache Shell Commands
httpd -v : Outputs the build date and version of the Apache server.
httpd -l : Lists compiled in Apache modules
httpd status : Only works if mod_status is enabled and shows a page of active connections
service httpd restart : Restarted Apache web server
MySQL Shell Commands
mysqladmin processlist : Shows active mysql connections and queries
mysqladmin drop databasenamehere : Drops/deletes the selected database
mysqladmin create databasenamehere : Creates a mysql database
Restore MySQL Database Shell Command
mysql -u username -p password databasename < databasefile.sql : Restores a MySQL database from databasefile.sql
Backup MySQL Database Shell Command
mysqldump -u username -p password databasename > databasefile.sql : Backup MySQL database to databasefile.sql
kill: terminate a system process kill -9 PID EG: kill -9 431
kill PID EG: kill 10550
Use top or ps ux to get system PIDs (Process IDs)
Each line represents one process, with a process being loosely defined as a running instance of a program. The column headed PID (process ID) shows the assigned process numbers of the processes. The heading COMMAND shows the location of the executed process.
Putting commands together
Often you will find you need to use different commands on the same line. Here are some examples. Note that the | character is called a pipe, it takes date from one program and pipes it to another. > means create a new file, overwriting any content already there. >> means tp append data to a file, creating a newone if it doesn not already exist. < send input from a file back into a command.
grep User /usr/local/apache/conf/httpd.conf |more This will dump all lines that match User from the httpd.conf, then print the results to your screen one page at a time.
last -a > /root/lastlogins.tmp
This will print all the current login history to a file called lastlogins.tmp in /root/
tail -10000 /var/log/exim_mainlog |grep domain.com |more This will grab the last 10,000 lines from /var/log/exim_mainlog, find all occurances of domain.com (the period represents ‘anything’,
– comment it out with a so it will be interpretted literally), then send it to your screen page by page.
netstat -an |grep :80 |wc -l Show how many active connections there are to apache (httpd runs on port 80)
mysqladmin processlist |wc -l Show how many current open connections there are to mysql