Htaccess issue
-
I have some urls in my site due to a rating counter. These are like:
domain.com/?score=4&rew=25
domain.com/?score=1&rew=28
domain.com/?score=5&rew=95These are all duplicate content to my homepage and I want to 301 redirect them there. I tried so far:
RedirectMatch 301 /[a-z]score[a-z] http://domain.com
RedirectMatch 301 /.score. http://domain.com
RedirectMatch 301 /^score$.* http://domain.com
RedirectMatch 301 /.^score$.* http://domain.com
RedirectMatch 301 /[a-z]score[a-z] http://domain.com
RedirectMatch 301 score http://domain.com
RedirectMatch 301 /[.]score[.] http://domain.com
RedirectMatch 301 /[.]score[.] http://domain.com
RedirectMatch 301 /[a-z,0-9]score[a-z,0-9] http://domain.com
RedirectMatch 301 /[a-z,0-9,=,&]score[a-z,0-9,=,&] http://domain.com
RedirectMatch 301 /[a-z,0-9,=&?/.]score[a-z,0-9,=&] http://domain.comNone of them works. Anybody? Solution? Would be very much appriciated
-
This is the document I was searching for. I always got lost as other resources did not explain all character means but I think I will at last be able to understand this one. Thanks again
-
Thanks again for your help, really, much appreciated. Have a nice day.
-
Can I suggest that you read through the docs? They're pretty good and have some nice intros:
http://httpd.apache.org/docs/current/rewrite/
http://httpd.apache.org/docs/current/rewrite/intro.html
% needed since it is a variable
^(.*)$ is 'match the url'
? at the end deletes the query string that came in.
Note, the ^(.*)$ is calculated first, then the condition.
So the whole thing says:
^(.*)$ .... for any urls,
RewriteCond.... where there is a query string with score, rel etc.http://domain.com? .... replace the whole thing with http://domain.com/
-
Can I ask you two more things?
First, could you please explain the regex to me as I don't understand a few parts, so:
RewriteCond %{QUERY_STRING} ^score=[0-9]&rew=[0-9]$
RewriteCond this is the condition hen rewrite should take place
% I don't know why it is necessarry just see it everywhere
{QUERY_STRING} gets the query string
^ matches from beginning
score=[0-9]* score=takes a number from 0-9 zero to more times
&rew=[0-9]*$ again with rew=RewriteRule rule fot the rewrite
^(.*)$ I totally don't get this one
http://domain.com? I don't know why ? is needed
[R=301,L] 301 redirectSecondly I would like to ask you for a code to remove .html endings from any urls.I think it should begin like
RewriteCond %{QUERY_STRING} (.*).html
But I am totally not enough for the second part. Could you please help me with this one as well?
-
Happy to help Zsolt, I know how frustrating it can be to get some rules working.
Here's a great place to test regex: http://gskinner.com/RegExr/
-
Splendid You are the MAN. Thanks
-
Try playing with something like this:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{QUERY_STRING} ^score=[0-9]&rew=[0-9]$
RewriteRule ^(.*)$ http://domain.com? [R=301,L]The score part of the URL are being treated as parameters.
An alternative would be (in GWT and BWC) to tell Google/Bing to ignore the score and rew parameters
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
-
Selling same products under separate brands and can't consolidate sites...duplicate content issues?
I have a client selling home goods online and in-store under two different brand names in separate regions of the country. Currently, the websites are completely identical aside from branding. It is unlikely that they would have the capacity to write unique titles and page content for each website (~25,000 pages each), and the business would never consolidate the sites. Would it make sense to use canonical tags pointing to the higher-performing website on category and product pages? This way we could continue to capture branded search to the lesser brand while consolidating authority on the better performing website. What would you do?
Technical SEO | | jluke.fusion0 -
Magento Category Suffix - redirect issue
Hi All, Just launched a new Magento store & set the category suffix to blank & not .html or / So the desired url is https://www.example.com/category-1 But I am seeing a 301 redirect being implemented: https://www.example.com/category-1/ redirect to: https://www.example.com/category-1 I cant see this is the list of 301 redirects within the redirect panel in Magento but Moz & another redirect checker is picking it up. I am missing a setting or something ? Many Thanks,
Technical SEO | | PaddyM556
Pat0 -
Google search console image indexing issue
Google search console tells that only '58 out of the 3553' images in the images sitemap are indexed. But if I search "site:example.com" in Google images there seem to be lots of images. There are no errors in the sitemap and I am still getting reasonable number of image search hits daily. Are the webmaster tools stats for images indexed accurate? When I click on the Sitemap Errors & Index Errors this is what i get - Error details: No errors found. https://www.screencast.com/t/pqL62pIc
Technical SEO | | 21centuryweb0 -
Issues with sitelnks anchor text
Hi Everyone, I'm currently running a job classified ad site, and having some problems with my brand site links. So in short, when I type my brand some sitelinks appear which is OK, but there is one that has the anchor text as "1", yep just a number one, as far as I know, Google takes the anchor text from internal linking, and since this the landing page for my search site.com/search-jobs I don't want to demote it. Now I started checking why the number "1" is actually showing and I figured it out it might be due to pagination, since the search results (?=page2, ?=page3, etc) were all linking from the bottom numbers to site.com/search-jobs with the almighty number 1, I took a decision on changing that link to site.com/search-jobs?page=1 and adding a canonical tag to the landing page to avoid duplicated content. The solution worked for a few days for private sessions only (anchor text was Search for jobs in Peru), but after that number 1 came back and I can't figure it out how to change it, tried to update the cache on search console on most pages that still had the previous version but to no avail. My boss and I are trying to fix this issue but no luck yet, should I update all of my pages' cache?, any help would be much appreciated.
Technical SEO | | JoaoCJ0 -
301 redirects without .htaccess
I have a client that recently moved from an old ZenCart e-commerce site to Volusion. The domain name did not change. We need to redirect a bunch of the old URLs; however, Volusion's redirect tool does not work for URLS with "?" . The old ZenCart structure is: http://www.mydomain.com/index.php?main_page=product_info&products_id=563 Volusion is a hosted platform and we do not have access to the .htaccess file. Any suggestions on a workaround? Thanks!Nancy <colgroup><col width="960"></colgroup>
Technical SEO | | NancyVPS
| |0 -
Duplicated rel=author tags (x 3) on WordPress pages, any issue with this?
Hi,
Technical SEO | | jeffwhitfield
We seem to have duplicated rel=author tags (x 3) on WordPress pages, as we are using Yoast WordPress SEO plugin which adds a rel=author tag into the head of the page and Fancier Author Box plugin which seems to add a further two rel=author tags toward the bottom of the page. I checked the settings for Fancier Author Box and there doesn't seem to be the option to turn rel=author tags off; we need to keep this plugin enabled as we want the two tab functionality of the author bio and latest posts. All three rel=author tags seem to be correctly formatted and Google Structured Data Testing Tool shows that all authorship rel=author markup is correct; is there any issue with having these duplicated rel=author tags on the WordPress pages?
I tried searching the Q&A but couldn't find anything similar enough to what I'm asking above. Many thanks in advance and kind regards.0 -
How do I fix issue regarding near duplicate pages on website associated to city OR local pages?
I am working on one e-commerce website where we have added 300+ pages to target different local cities in USA. We have added quite different paragraphs on 100+ pages to remove internal duplicate issue and save our website from Panda penalty. You can visit following page to know more about it. And, We have added unique paragraphs on few pages. But, I have big concerns with other elements which are available on page like Banner Gallery, Front Banner, Tool and few other attributes which are commonly available on each pages exclude 4 to 5 sentence paragraph. I have compiled one XML sitemap with all local pages and submitted to Google webmaster tools since 1st June 2013. But, I can see only 1 indexed page by Google on Google webmaster tools. http://www.bannerbuzz.com/local http://www.bannerbuzz.com/local/US/Alabama/Vinyl-Banners http://www.bannerbuzz.com/local/MO/Kansas-City/Vinyl-Banners and so on... Can anyone suggest me best solution for it?
Technical SEO | | CommercePundit0 -
Standard Responses Causing Duplication Issues
Hi Guys We have a Q&A section on our site which we reply to customers using standard responses which have already been approved. This is causing a lot of duplication errors, however due to the nature of our business we need to use these responses. Is there anything that we can do to stop this? Matthew
Technical SEO | | EwanFisher0