friendly url

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
delibertad
Forum Newbie
Posts: 1
Joined: Thu Jul 09, 2009 8:52 am

friendly url

Post by delibertad »

hello team,

nice too meet you, I'm form Costa Rica.
well... since three hours ago I has been trying to gets user be redirect from a link like this:
example.com/show.php?id=10
to:
example.com/page/10

Ok? let me explain.. If I access to example.com/page/10 the web browser shows the content of example.com/show.php?id=10, but if I access to example.com/show.php?id=10 the web browser doesn't "redirect" to example.com/page/10 and doens't not change the url in the adress bar.
I use a .htaccess file:

Code: Select all

 
Options +FollowSymLinks
RewriteEngine On
 
RewriteRule page/(.*)$ show.php?id=$1 [R=301,L]
 
how can I get user be redirect from ugly url to pretty url?

thanks :)
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: friendly url

Post by Darhazer »

You have to use a RewriteCond with %REQUEST_URI to check the address in the address bar, and make a redirect... and the other (existing one) rule should be without the redirect
Post Reply