More mod_rewrite help.

Posted on 2005-03-07
Medium Priority
Last Modified: 2010-03-04
I asked a questions here:

I got an answer, here is what I am using:
RewriteEngine on
Options +FollowSymlinks
RewriteRule ^index\.php - [L]
RewriteRule ^([^/]+)/([^/.]+)/?$ /new/index.php?d=$1&p=$2 [L]

Now, I need to be able to have the URL like this: http://company.com/new/variable/variable/?foo=a

when I try that the foo=a is never recognized. Is there a simple way to make the URL query come into the rewrite rule.
Question by:ssammons
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 27

Accepted Solution

caterham_www earned 1000 total points
ID: 13480430
add the QSA-Flag:

RewriteEngine on
Options +FollowSymlinks
RewriteRule index\.php - [L]
RewriteRule ^([^/]+)/([^/.]+)/?$ /new/index.php?d=$1&p=$2 [L,QSA]
LVL 27

Expert Comment

ID: 13480498
the result of the flag is that the querystring from the request (foo=a) is not replaced by the substitution but added to the substitution.

So you'll get /new/index.php?d=variable1&p=variable2&foo=a in this example

Author Comment

ID: 13480520
Yep thanks exactly what I needed. I read right over that in the docs...just spelled out too kryptically for my brain power :P I live for examples thanks!

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month13 days, 6 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question