Mobile-Menu iFuturz Infoweb Inc. Contact Portfolio

26

Oct

How to URL Rewriting with .htaccess File

  • Category:
  • PHP
How to URL Rewriting with .htaccess File

Posted On : October 26, 2013

| 1 Comment

In this post, URL Rewriting is help to search page ranking and also looks like neat on the browser address bar. It’s called Friendly URL.

For Example:

Suppose you have original URL like:

Original URL.

http://abcd.com/userdetails.php? id=username&pageid=2

Rewriting Friendly URL.

http://abcd.com/userdetails.php/username/2

You need to put this below code in  .htaccess file

//This code is for First Parameer

RewriteEngine On

RewriteRule ^([a-zA-Z0-9_-]+)$ userdetails.php? user =$1

RewriteRule ^([a-zA-Z0-9_-]+)/$ userdetails.php? user =$1

 

//This code is for Second Parameter

RewriteEngine On

RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)$ userdetails.php? user =$1& pageid =$2

RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)/$ userdetails.php? user=$1& pageid =$2

 

  • Tags:

Comment

Posts

  • Excellent web site you have got here.. It’s difficult to find high-quality writing like yours these days. I honestly appreciate people like you! Take care!!

    Mitzi