URL Rewriting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
same2cool
Forum Newbie
Posts: 11
Joined: Tue Sep 24, 2013 5:05 am
Location: Lahore, Pakistan
Contact:

URL Rewriting

Post by same2cool »

My website url is like
domain.com/services.php?p=writing-program
that I can use $_GET['p']

I want to convert it as
domain.com/services/writing-program

How to do it. It is SEO friendly Rule
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: URL Rewriting

Post by Celauran »

Simple .htaccess rule should do the trick

Code: Select all

RewriteEngine on

RewriteRule ^services/(.*)$ services.php?p=$1 [L]
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: URL Rewriting

Post by Celauran »

I recommend taking a look at and possibly bookmarking this site: http://htaccess.madewithlove.be/
Post Reply