301 redirect with /? in URL
-
For a Wordpress site that has the ending / in the URL with a ? after it... how can you do a 301 redirect to strip off anything after the /
For example how to take this URL
domain.com/article-name/?utm_source=feedburner
and 301 to this URL
Thank you for the help
-
Hi Robert,
The rewrite rules shared by Patrick should work well for that although you could also use Yoast's Wordpress SEO plugin that features options to do that through the control panel.
Nonetheless, in general what can be better in performance and also for tracking purposes with your site URL, leaving tracking parameters while avoiding content duplication content is to use canonical tags. You can also set them easily for Wordpress with Yoast's plugin.
I hope this helps!
Aleyda
-
Have you tried the Redirection tool when you login to the back-end of the site?
-
Just looking to remove it. Thanks for the info, will see if this works.
-
Do you want to capture the parameter value or do you want to just remove it immediately? If you want to remove it without worrying about capturing the value in Google Analytics, then this code may work -
RewriteEngine On
RewriteCond %{QUERY_STRING} !="" #if there is a query string
RewriteCond %{QUERY_STRING} !^p=.* #wordpress users: allow post tempalinks
RewriteCond %{REQUEST_URI} !^/wp-admin.* #wordpress users: don't break admin
RewriteRule ^(.*)$ /$1? [R=301,L] #remove query stringI got this code from http://briancray.com/posts/htaccess-hack-remove-url-query-strings/
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
301 Redirects to relative URLs not absolute a problem?
Hi we recently did a migration and a lot of content changed locations see: https://d.pr/i/RvqI81 Basically, the 301 goes to the correct location but its a relative URL (as you can see from the screenshot) rather than absolute URL. Do you think this is a high priority issue from an SEO standpoint, should we get the developer to change the redirects to absolute? Cheers.
Intermediate & Advanced SEO | | cathywix0 -
Ranking after redirecting two URLs to a new domain
I run two websites which operate in similar business sectors. Each has a calculator tool that offers the same functionality. The pages rank 2nd and 5th for the key search term. I'd like to improve the functionality of this and have thought about setting up a new domain for this calculator to move it away from the main sites. If I did this and 301 redirected both pages to the new domain do you think I'd maintain a strong ranking position for this search term on the new domain? Thanks for any advice.
Intermediate & Advanced SEO | | craigramsay0 -
302 redirected URLs - login, account pages
We have a 302 redirection on some of our pages which involved login/account pages. So, some pages are 302 (temporarily) redirected to the login pages which is common especially in e-commerce sites (see screenshot). For SEO practices, what would be best to address this (if this an issue)? a. Block the login/account pages using robots.txt? b. Block the login/account pages using meta noindex? c. Leave them as is since it's a non-issue. d. Other recommendations, please specify in the answers.. Thanks! 2S9xn
Intermediate & Advanced SEO | | jayoliverwright0 -
Is it bad I have a cluster of canonical urls that 301 re-direct?
Just went through a migration. We have a group of canonical URLs that are NOT the preferred url, but 301 re-direct to the preferred URL. Does this essentially "break even" and the incorrect canonical URL becomes obsolete? And/or would this be considered potentially bad and confusing for bots?
Intermediate & Advanced SEO | | lunavista-comm0 -
Web developer won't 301 redirect to my new website....what can I do?
I want to come away from our third party web developer and use a new website with different web developers, however the web developer wont 301 redirect the old url's to the new ones. Is he required to do this by law? Is there away of doing the 301 redirects without him? Any advice would be much appreciated. Many thanks,Tom
Intermediate & Advanced SEO | | CoGri0 -
Request a 3rd party to change the URL to your site or 302 redirect it?
Hi, My new site design for small hope went live about 3 months ago and I changed the URL structure. I'm kind of new to the SEO game, but I've done quite a bit of research, successfully implemented all the 301s I need and tested them and everything is working fine. But I'm having a little trouble with this propagating through Google et al. Most of the advice is to sit tight and wait but I want to be a little more proactive. So even though the 301s are in place, can I ALSO send emails to our partners and request link changes? Would Google find this suspicious behaviour and penalise us? Thanks, Adam
Intermediate & Advanced SEO | | NaescentAdam0 -
Quoestion about 301 redirect
Hey, I have interesting questions regardin 301 redirect (At least I think it's Interesting:) ) So i have this websites that compares different lenders, url below 🙂 If you go to the homepage then the first thing you see is different loan amounts in 50-99 euro range. Also you can check out different loan amounts like 100-149€, 150-199€, 200-249€ and so on. For now i have used 301 redirect and Noindex and Nofollow for all the different "loan amounts" urls. Examples below etc Is it a good idea to use 301 on all such pages to point to the homepage?
Intermediate & Advanced SEO | | TauriU0 -
301 Redirect or Canonical Tag or Leave Them Alone? Different Pages - Similar Content
We currently have 3 different versions of our State Business-for-Sale listings pages - the versions are: **Version 1 -- Preferred Version: ** http://www.businessbroker.net/State/California-Businesses_For_Sale.aspx Title = California Business for Sale Ads - California Businesses for Sale & Business Brokers - Sell a Business on Business Broker Version 2: http://www.businessbroker.net/Businesses_For_Sale-State-California.aspx Title = California Business for Sale | 3124 California Businesses for Sale | BusinessBroker.net Version 3: http://www.businessbroker.net/listings/business_for_sale_california.ihtml Title = California Businesses for Sale at BusinessBroker.net - California Business for Sale While the page titles and meta data are a bit different, the bulk of the page content (which is the listings rendered) are identical. We were wondering if it would make good sense to either (A) 301 redirect Versions 2 and 3 to the preferred Version 1 page or (B) put Canonical Tags on Versions 2 and 3 labeling Version 1 as the preferred version. We have this issue for all 50 U.S. States -- I've mentioned California here but the same applies for Alabama through Wyoming - same issue. Given that there are 3 different flavors and all are showing up in the Search Results -- some on the same 1st page of results -- which probably is a good thing for now -- should we do a 301 redirect or a Canonical Tag on Versions 2 and 3? Seems like with Google cracking down on duplicate content, it might be wise to be proactive. Any thoughts or suggestions would be greatly appreciated! Thanks. Matt M
Intermediate & Advanced SEO | | MWM37720