URL Rewrite

Discuss practical ways rearrange URLs using mod_rewrite.

URL Rewrite

Postby Anderw_iow » Thu Oct 23, 2008 11:09 am

Hi, I am tring to use Rewrite on a project I am working on I have got it work

Code: Select all
RewriteEngine on
RewriteRule index/xps/(.*)/pid/(.*)/ index.php?xps=$1&pid=$2
RewriteRule index/xps/(.*)/pid/(.*) index.php?xps=$1&pid=$2   


which does work it redirects me from "index/xps/pview/pid/98/" to "index.php?xps=pview&pid=98" but I thought (I might be wrong) the whole point of rewrite was that "index.php?xps=pview&pid=98" stayed hidden but for me it still appears in the URL bar.

Any ideas, I hope I have explained it well this is my first day using url rewrite! I might just be being stupid but just would like to clear this up :)
Andrew
Anderw_iow
 
Posts: 1
Joined: Thu Oct 23, 2008 11:05 am

Postby richardk » Thu Oct 23, 2008 1:18 pm

The purpose of mod_rewrite like yours is to make the new URL work. Mod_rewrite does not change the links in the source of your pages, you must edit your script.

Code: Select all
Options +FollowSymLinks -MultiViews

RewriteEngine On

RewriteRule ^index/xps/([^/]+)/pid/([0-9]+)/?$ /index.php?xps=$1&pid=$2 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: Majestic-12 [Bot] and 5 guests

cron