Tutorials >> View >> 3
Yahoo chat: marklester_aover
Bookmark and Share

Search Engine Friendly URL - convert .php and replace with .html file extension using .htaccess

Converting or hiding .php and replace with .html file extension using .htaccess is the process of Rewriting your URL. Before we could start doing that, first enable your mod_rewrite in your apache.

Learn the codes below:

What is .htaccess file?

.htaccess files can give you extra control over your server, allowing you to password protect directories, enable server side includes, generate custom error messages, and block users by IP address among other things. An htaccess file is a simple ascii text file which you create or edit in a text editor. The dot (.) before the word htaccess indicates that .htaccess is a file extension. Some text editors will add on an additional .txt file mextension when you save your document.

How to enable how to mod_rewrite module in apache installed under windows environment.

1) Find the “httpd.conf” file under the “conf” folder inside the Apache’s installation folder.
2) Find the following line “#LoadModule rewrite_module modules/mod_rewrite.so” in the “httpd.conf” file.You can do this easily by searching the keyword “mod_rewrite” from find menu.
3) Remove the “#” at the starting of the line, “#” represents that line is commented.
4) Now restart the apache server.
5) You can see now “mod_rewrite” in the Loaded Module section while doing “phpinfo()”.

To begin wit, create a file name ".htaccess" on your root directory of your website. Insert the the codes below on the .htaccess file if you have already an .htaccess file copy and paste the codes on your .htaccess, insert it below the existing .htaccess codes.

To make things easier download the sample script below...


# put this .htaccess file to your site root directory #

Options +FollowSymLinks
# start the Rewrite Engine or Rewrite Mode #
RewriteEngine On

# check the url if it has an extension of .html #
RewriteCond %{REQUEST_URI} \.html$
RewriteRule ^(.*) index.php

Click image to download the Zip file: SEF-URL-with-html-ext.zip

# of Comments (0)

Add your comment here...

Please feel free to make a comment and suggestion on this tutorial. Your comment and suggestion will help improve the tutorial for the benefit of you and others. Thank you...

Name : *
Email Add : *
URL (include http://):
Messages : *
Security Code : *
(*) Must not leave blank.
captcha

Our Main Services

We develop and deliver the following services:

Latest News...

Search My Site

 This Site   Web

Google Ads

Google Ads

Powered By:

Advertise

Place your Custom Advertise here $29 for 1 month. Image dimension 276x180 pixels. Click the Paypal "Buy Now" button below.