I'm not sure how it was before, but to pass the query string, you need to modify:
RewriteRule . /index.php [L]
to:
RewriteRule . /index.php [L,QSA]
That way the query string gets appended after the url has been rewritten to index.php
.
Вопрос
Something very odd has happened with a site/server that I do not have hosting access to.
I have a script that has been running for over 2 years. It has recognized $_GET
vars from the URL address with no problems.
Now all of a sudden the script does not process any $_GET
or $_REQUEST
vars. I have made no changes to my PHP scripts since I launched them 2-3 years ago.
Does anyone know if there are recent server updates or PHP updates that can cause a working script to stop recognizing $_GET
vars?
WordPress Plug-in script:
function email_this($data)
{
global $post;
if(isset($_GET['id']))//if it is a form
{ // 2014-05-03 SCRIPT DOES NOT FALL THROUGH HERE
email_send(htmlspecialchars($_GET['id']));
}
else//if the button should show
{ // 2014-05-03 SCRIPT FALLS THROUGH HERE
$data_and_emailthis = $data; // 2011-03-23: split original statement into 2 statements
$data_and_emailthis .= '<!--'; // 2011-03-23: added this to comment out ability to email articles from non-specified pages
$data_and_emailthis .= '<br/><p><a href="/email/?id='.get_the_ID().'" rel="nofollow" title="Email this post to your friend" style="font-weight: bold;"><img src="'.get_bloginfo('wpurl').'/wp-content/plugins/emailthis/email.gif" style="border: 0px; padding: 0px; margin: 0px;" alt="Email this post"> Email this post</a></p>'; // 2011-03-23: split original statement into 2 statements
$data_and_emailthis .= '-->'; // 2011-03-23: added this to comment out ability to email articles from non-specified pages
}
//return
return $data_and_emailthis;
}
add_filter('the_content', 'email_this');
URL:
http://mydomain.com/email/?id=1506
.htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
<Files 403.shtml>
order allow,deny
allow from all
</Files>
deny from 41.207.163.6
Решение
I'm not sure how it was before, but to pass the query string, you need to modify:
RewriteRule . /index.php [L]
to:
RewriteRule . /index.php [L,QSA]
That way the query string gets appended after the url has been rewritten to index.php
.