简体   繁体   中英

Wordpress is stripping parameters from URL

My Wordpress site is stripping parameters from the URL. This is detrimental to tracking google adwords and bing ads because they rely? bunchofparameters to be appended to the URL.

I tried looking in the redirect plugin and the .htaccess , but all the .htaccess has is:

# 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

To get a custom querystring in a URL, you need to make Wordpress aware of it first. Wordpress does some complex URL rewriting and for security, it also strips out any parameters it doesn't recognize.

You'll need to create an action on init which calls add_rewrite_tag() one or more times to register the custom queryvars you need.

See the add_rewrite_tag Codex page for details.

I figured it out. The wordpress site I was managing had a Wordpress SEO plugin that had "Redirect ugly URL's to clean permalinks. (Not recommended in many cases!)" checked. This was what was stripping my query parameters!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM