Problems with mod_rewrite and GET

So, I had a question earlier about mod_rewrite which you find here mod_rewrite changing /subpage/ to /subpage

But now I have a whole new problem with this... How do I make GET work?

Like if I need to pass some variables with GET, ex: mypage.com/subpage/?name=Jamie

My mod_rewrite looks like this:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^([A-Za-z0-9-]+)/?$ ?p=$1 [L]

I understand that the problem probably has to do with that I already pass and rewrite one GET request. So how do i tweak this to accept any other GET-request i might need to process?

UPDATE: To clarify the problem a bit. If I try the url mypage.com/subpage/?name=Jamie page loads as if i used url mypage.com/subpage/ and "name" is never passed. Using my original url mypage.com?p=subpage&name=Jamie works as it should.

I guess i need to tweak this somehow... but how? Thank you for taking your time reading my probably easy question!

Answers


Use the QSA flag — Query String Append:

RewriteRule ^([A-Za-z0-9-]+)/?$ ?p=$1 [L,QSA]

'qsappend|QSA' (query string append) This flag forces the rewrite engine to append a query string part of the substitution string to the existing string, instead of replacing it. Use this when you want to add more data to the query string via a rewrite rule.


Need Your Help

Multiple words not getting searched , not taking space

java android mysql sql

when i pass string with space in bw the words to the servlet and run the android aaplication

Logging done right

c# logging log4net c#-2.0

So my problem is about logging, and how to handle the log statements which can have influence on your code and your runtime behavior.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.