How on earth can I get my query string to disappear??

Discuss practical ways rearrange URLs using mod_rewrite.

How on earth can I get my query string to disappear??

Postby memerson » Tue May 13, 2008 8:12 am

I'm trying to redirect a URL typed into the browser from:

http://www.domain.com/1/2

to:

http://www.domain.com/trigger.php?page=1&ref=2 (using the digits in the original URL)

However - I do not want the query string displayed in the browser bar, rather still have the original URL. My .htaccess file is as follows:

Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/? trigger\.php?page=$1&ref=$2 [QSA,L]


I've tried many different variations, none seem to make it remain the original URL....

Thanks in advance
Michael
memerson
 
Posts: 11
Joined: Tue Apr 17, 2007 6:04 am

Postby richardk » Tue May 13, 2008 3:36 pm

When you go to /1/2 you get visibly redirected to /trigger.php?page=1&ref=2?

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

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

Postby memerson » Wed May 14, 2008 12:28 am

Thank you! That worked perfectly. I think I probably wrote a lot more stuff than I needed to.
memerson
 
Posts: 11
Joined: Tue Apr 17, 2007 6:04 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 71 guests

cron