My project have data about different websites so I have rewritten urls using .htaccess so that when ever someone passes a name containing a dot(.) to my website, it shows the site.php page. here is my code for that:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9\_\-]+(\.)[a-zA-Z0-9\_\.\-]+)/?$ site.php?url=$1
RewriteRule contact$ contact.php
This sends site name as parameter to site.php. Now I want one more parameter to be passed to is like it could have been passed in general, for ex. I want the site to get real time updated data, i want to pass ?update=true so that it updates the data from internet rather then taking it from database. But passing parameter like this
http://www.mysite.com/anysite.com?update=true
isn’t working, how can I pass additional parameters to my existing rewritten url?
The
[QSA]flag (“query string append“) will append any received query string onto the rewritten URL. I have also added the[L]flag as a best practice to prevent a match to your first rule also matching an additional rule later on in your chain, should one ever be added.However, if I have misunderstood the problem and you don’t need for the browser to be sending
update=truebut rather just want to force it on all requests, simply add it to the rewrite rule: