Category Archives: Apache

How To Install & Configure phpMyAdmin On Ubuntu 12.04 & Greater Versions?

phpMyAdmin is a free software that provides you a user friendly interface to work with MySQL on the web. It simply provides you a convenient visual frontend to access MySQL capabilities. This tutorial shows you the steps for installing phpMyAdmin on Ubunu Linux so before installing it make sure you must have root privileges on your virtual private server.

Continue reading How To Install & Configure phpMyAdmin On Ubuntu 12.04 & Greater Versions?

Easily Add Cool Responsive Bootstrap Tabs In WordPress

Easy Responsive Tabs is the new WordPress plugin you can use for adding responsive tabs inside your pages, posts and other custom post types etc and you can do this very easily by using its tinyMCE shortcode button in WordPress visual editor. See it in action here.

Continue reading Easily Add Cool Responsive Bootstrap Tabs In WordPress

Easiest Way Of Generating A Robot.TXT File For Your Website

A robots.txt is a text file kept on your website’s home directory i.e., Public_HTML. The file is checked by all search engines spiders before they start crawling your website’s content to know which files, file types and directories are not allowed to be archived. So by using a Robot.Txt file you can exclude content you don’t want to appear in search engine results. Even it allows you to block the way for search engine crawlers including the safe ones like Google.

Continue reading Easiest Way Of Generating A Robot.TXT File For Your Website

How To Stop Hotlinking Via .htaccess?

Hotlinking means showing images from other sites which increases bandwidth usage. You can stop Hotlinking in your WordPress site. All you need to do is open .htaccess file present in your WordPress root directory and the given code.

RewriteBase /
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?mysite.com/.*$ [NC]
RewriteRule .(gif|jpg|swf|flv|png)$ /feed/ [R=302,L]

How To Restrict Other Servers From Accessing Your Files ?

If your site stores popular image files then for reducing bandwidth usage you can use this Apache hack for denying servers to access your files. Open your sites .htaccess file for editing and add the following code:

<FilesMatch “.(gif|jpe?g)$”>
SetEnvIf Referer “^http://([^/]*.)?mydomain.com/” request_ok = 1
Order Allow, Deny
Allow from env=request_ok
</FilesMatch>

This restricts other domains form accessing all GIF or JPG files in  your website.

How To Configure Apache WebSite To Use Multiple Ports ?

  1. Open httpd.conf file in your host.
  2. Find Listen 80 and on the next line add Listen 8080
  3. Find VirtualHost section for your Site config.
  4. Add *:8080. It should look like this: <VirtualHost *:80 *:8080>
  5. Restart Apache
  6. Test your work by hitting your site to the new port number. Example: http://www.yoursite.com:8080

This would be helpful for you if your ISP is blocking any port. You can add an alternate port in your website. Here we have used port 8080 but you are free to use any other.

Creating Temporary And Permanent Redirects Using Apache

301 is a permanent redirect and 302 is a temporary redirect. 301 redirect is used when you want to redirect pages without penalizing them in search engines. And 302 redirect is used when you want to set up temporary redirect for keeping your page rank better in search engines. Learn more.

How To Set Up Permanent Redirect Using Apache ?

Open your site’s .htaccess file.

If there is no .htaccess redirect then create a new text file in your site’s root.

Add this line at the very end of your .htaccess file:

Redirect 301 /REDIRECT_PATH NEW_URL

Where:

REDIRECT_PATH = Directory path on your web server. And

NEW_URL = Is the path you want the pages redirected to.

Save the file and test your URL.

Example: 

Redirect 301 /tags/lamp/ https://www.sangkrit.net/tags/lamp/

How To Set Up Temporary Redirect Using Apache ?

Open your site’s .htaccess file.

If there is no .htaccess redirect then create a new text file in your site’s root.

Add this line at the very end of your .htaccess file:

Redirect 302 /REDIRECT_PATH NEW_URL

Where:

REDIRECT_PATH = Directory path on your web server. And

NEW_URL = Is the path you want the pages redirected to.

Save the file and test your URL.

Example:

Redirect 302 /tags/lamp/ https://www.sangkrit.net/tags/lamp/

Difference Between Permanent And Temporary Redirects

301 redirect is a permanent redirect whereas 302 is a temporary redirect. Permanent redirects tell search engines that old URL is out so that they can pull this new URL in it’s place. 301 is used when you want to preserve the page index and keep the page rank.

One Command LAMP Server Installation

Installing LAMP Server

  • Open your Linux Terminal.
  • Type: sudo apt-get install lamp-server^
  • Press Enter

Checking the Installation

  • Open a web browser
  • Type: http://localhost/
  • If your browser shows the message: “It Works” then you have successfully installed LAMP

Tasksel Method

Other than the above given method you may use the Tasksel method for installing LAMP server. Use following given commands on your Linux Terminal:

sudo apt-get install tasksel
sudo tasksel install lamp-server

PhpMyAdmin

If you need to install PhpMyAdmin for managing your website’s database:

sudo apt-get install phpmyadmin