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
-
SEO Question - Are 503/504 errors an issue?
Lately I've noticed more and more 503/504 errors being flagged in my MOZ reports. One week I had over 1300 errors show up. I checked Google Webmaster Tools and Bing Webmaster tools and noticed they were showing up in there too, although not near as many (50 or less per day). I contacted my hosting company about it and they said these were normal and that it was due to one nameserver reaching capacity, but that there was a backup nameserver that kicks in. I've seen one or two of these errors show up before, but never more than one or two a week. Is this something I should be concerned about?
Technical SEO | | Kyle Eaves0 -
Yahoo Local SERPs Index Issue
I recently updated all my website page Titles and was checking to see how many have been crawled so far. On Yahoo/Bing I noticed something very strange when entering site:bandpages.ie in the search field. Selection Buttons (top of SERPs): 'Web' search shows all my pages indexed 'UK' has has most pages 'Only In Ireland' has just 1 page indexed - which is the site RSS Feed and nothing else! The site has been live for 2 years now. Considering we don't trade with the UK and our main focus is here in Ireland - what is going wrong? Why doesn't Yahoo/Bing index list the site pages in the Ireland index? Any insights or solutions appreciated...
Technical SEO | | Ubique0 -
Modx revolution- getting around index.php vs. root duplicate content issue?
Basically, SEOMoz bots are flagging our index.php and root files as duplicate content of one another, therefore cutting the page authority of each. What we want to do is make the root the canonical preference over index.php. Ordinarily, we should be able to do this in the htaccess file. For some reason, as the site has been built into a cms using ModX Revolution, this does not seem to work. We've tried A TON of htaccess rewrite mods to resolve this issue to no avail. We have also tried revising our sitemap to include only the root address. Any ideas? We'll try most anything at this point. Thanks in advance.
Technical SEO | | G2W0 -
Canonical Issues with Wordpress
Hi all, I have just started using Wordpress SEO by Yoast and still having a hard time correcting my Canonical issues for all posts with a .html at the end. The pluggin allows you to add a '/' to the end for canonical issues, but just for pages, not posts. How best in Wordpress to make my post change from .html/ to .html. I really don't want to go to the hassle to make each URL a new 301 redirect in my .htaccess. I hate the .html, but if they are going to stay, how can I make sure I get the .html/ link juice back to them. Many thanks!
Technical SEO | | RunningInTheRain0 -
Looking to hire someone to help on my website. On page issues with subpages outranking homepage
Hello, I have a site that has been doing good for quite a while now. But lately I'm running into issues with on page seo. I have ranked well for long periods of time, but changes like adding content or moving stuff around has bumped me out of the rankings. I would prefer not to publicly disclose the site. My main keyword I rank for is "word1 word2". I notice if I do a site: search for "word1 word2" homepage is #1, site search for just word1 it's #1 as well, but the word2 returns a category listing above the homepage. I noticed this happen right as I fell back from the rankings. I am looking to hire an SEO profession to help me out with on page issues. I've come to admit that I just don't understand something about this and I need help from someone who has a lot of experience with this. I was hoping to find recommendations by people here for a company I could hire for this. I would want to pay no more than $1,000. I hope that budget is high enough to get a skilled individual/company working with me. I'm not sure where to search for online to get a skilled on page seo professional, so I thought a personal recommendation from someone here would possibly be able to help. Thanks
Technical SEO | | nux0 -
How much of an issue is it if a site is somehow connected to a site that was penalized by Google?
I am working with someone that is about to launch a new site, and one of the sites was affected by the Panda update. Does it matter if the two sites are connected? Share the same hosting provider and same Google Webmaster's account?
Technical SEO | | nicole.healthline0 -
Issue with 'Crawl Errors' in Webmaster Tools
Have an issue with a large number of 'Not Found' webpages being listed in Webmaster Tools. In the 'Detected' column, the dates are recent (May 1st - 15th). However, looking clicking into the 'Linked From' column, all of the link sources are old, many from 2009-10. Furthermore, I have checked a large number of the source pages to double check that the links don't still exist, and they don't as I expected. Firstly, I am concerned that Google thinks there is a vast number of broken links on this site when in fact there is not. Secondly, why if the errors do not actually exist (and never actually have) do they remain listed in Webmaster Tools, which claims they were found again this month?! Thirdly, what's the best and quickest way of getting rid of these errors? Google advises that using the 'URL Removal Tool' will only remove the pages from the Google index, NOT from the crawl errors. The info is that if they keep getting 404 returns, it will automatically get removed. Well I don't know how many times they need to get that 404 in order to get rid of a URL and link that haven't existed for 18-24 months?!! Thanks.
Technical SEO | | RiceMedia0 -
Issue of my website Google Penalty or Recent Algorithm Changes only!
I recently faced issue of Google recent algo update on my main website. I found my ranks were all of 5th to 7th page even with website name without .com at end we have 5th page shown our biz website. It was a news portal and behind in subdomain i was running my web hosting website. 1. I removed all news content from my website since i thought the news agency send me content send same content to others may cause in the issue so i removed the NEWS AREA 2. I am turn off all of my old subscriptions or membership of blog networks etc. to make sure i get proper good backlinks with good research etc. Is there anybody who can suggest me what shall i take more action ? Mean any kind of further good suggestion i will highly appreciate if anyone can help me with any suggestions of SEO. I know there are many people who knows lots about it thus i thought to ask to community.. I am also unsure its a Google panelty or a Google recent update negative changes to my website ? However i have already filled reconsideration request as an possible alternative by explaining google that we are no more NEWS CONTENT Website. Will wait for responses...
Technical SEO | | anand20100