Skip to main content

Posts

Showing posts with the label SEO

Setting a Custom 404 Error Page in .htaccess

We have to handle error page request by .htaccess like if someone requesting for 404,500 type of request/errors. These are some of the most common errors: 401 – Authorization Required 400 – Bad request 403 – Forbidden 500 – Internal Server Error 404 – Wrong page To handle these request/errors follow below code. # Error pages handling errorDocument 401 http://www.youwebsite.com/error_401.html errorDocument 400 http://www.youwebsite.com/error_400.html errorDocument 403 http://www.youwebsite.com/error_403.html errorDocument 500 http://www.youwebsite.com/error_500.html errorDocument 404 http://www.youwebsite.com/error_404.html Each time if someone request for wrong page(404) he will be automatically redirected to error_404.html page, You can customize these pages as per you need. If you want to disable whole directory then put below code in your .htaccess file # Disable directory browsing, Nobody directly browse your directory. Options All -Indexes

Beginner guide to htaccess - Setup seo friendly url for your website

Here in this tutorial we’ll learn about .htaccess properties and how to setup .htaccess file in our project for custom error pages handling and create seo friendly url. First of all we need to know what is “.htaccess” ? htaccess is short for Hypertext Access, and is a configuration file used by Apache based web servers, When a .htaccess file is placed in a directory which is in turn ‘loaded via the Apache Web Server’, then the .htaccess file is detected and executed by the Apache Web Server software. Create filename “.htaccess” and save it to your project root directory. Note: Before executing this file please make sure that you have successfully enabled mod_rewrite extension in php.ini file Example-1: Create your awkward shaped urls into seo friendly urls using .htaccess Suppose you have these 3 types of urls in your project. http://www.example.com/profile.php?uid=12345 http://www.example.com/profile.php?username=rohit http://www.example.com/search.php?q=delh