logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Rewrite URL
Author
gijs



Joined: 27 Apr 2012
Posts: 189
Location: The Netherlands

PostPosted: Mon 24 Nov '14 23:59    Post subject: Rewrite URL Reply with quote

I'm looking for a way to add a string to the end of an url if it contains a certain string (while using a .htaccess file).

If the url contains: derp.php it will add the following to the end of the url: &code=TEST

E.g. if an url contains derp.php?blabla it will be changed to: derp.php?blabla&code=TEST

How can I accomplish this?
Back to top
gijs



Joined: 27 Apr 2012
Posts: 189
Location: The Netherlands

PostPosted: Wed 26 Nov '14 20:48    Post subject: Reply with quote

Code:
RewriteCond %{QUERY_STRING} ^(.*)derp.php(.*)$
RewriteRule %1?blabla&code=TEST%2


Would the above code in my .htaccess file do the trick?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 08 Dec '14 18:24    Post subject: Reply with quote

There are some examples at https://wiki.apache.org/httpd/RewriteQueryString
Back to top


Reply to topic   Topic: Rewrite URL View previous topic :: View next topic
Post new topic   Forum Index -> Apache