The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 23, 2019, 10:40:25 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: .htaccess Rewrite Rule  (Read 3295 times)
DangerMouse
Expert
****
Offline Offline

Posts: 244



View Profile
« on: November 25, 2009, 07:03:02 AM »

Hey all,

Little bit of an easy question I'm sure, but Google has failed me!

Code:
RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}

I'm looking to add to the above OSCommerce rewrite rule to point to a different file if a specific query paramater is present i.e. if inbound URL query string contains "test=a" then change the rewrite path appending the query string back to a different file, ideally minus the paramater I'm testing for.

I've hacked around for a bit but to no avail. Any ideas?

Cheers,

DM
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: November 25, 2009, 07:21:15 AM »

I don't have much time this morning ... have you tried adding [QSA] as a modifier at the end?
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Bompa
Administrator
Lifer
*****
Offline Offline

Posts: 564


Where does this show?


View Profile
« Reply #2 on: November 25, 2009, 05:20:32 PM »

Hey all,

Little bit of an easy question I'm sure, but Google has failed me!

Code:
RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}

I'm looking to add to the above OSCommerce rewrite rule to point to a different file if a specific query paramater is present i.e. if inbound URL query string contains "test=a" then change the rewrite path appending the query string back to a different file, ideally minus the paramater I'm testing for.

I've hacked around for a bit but to no avail. Any ideas?

Cheers,

DM

Hi DM,

What would the format of the new file be?  Still like this: product_info.php?products_id=$2&%{QUERY_STRING} ?
I mean, would the "new file" still have a products_id value?

(When I'm looking for something specific, I usually just use a rewritecond.)

Bompa
Logged

"The most beautiful and profound emotion we can experience is the sensation of the mystical..." - Albert Einstein
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!