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
-
URL ASCII Characters Issue
Hi guys; Is there any different between URL whit capital ASCII code and URL with small ASCII Code? For example I have 2 URLS for one page like this: 1- 332-%D8%AA%D8%AD%D8%B5%DB%8C%D9%84-%D8%AF%D8%B1-%DA%A9%D8%A7%D9%86%D8%A7%D8%AF%D8%A7.html 2- 332-%d8%aa%d8%ad%d8%b5%db%8c%d9%84-%d8%af%d8%b1-%da%a9%d8%a7%d9%86%d8%a7%d8%af%d8%a7.html both of them point to same page but no 1 is non SSL and no 2 is ssl version! and whole pges of site forces to https
Technical SEO | | seoiransite0 -
RSS feed issue
My Wordpress blog RSS feed is not working correctly and I can't figure why. This is the error I am getting in my sidebar where the RSS feed used to work properly. My Blog is http://www.seadwellers.com/key-largo-diving-blog/ RSS Error: This XML document is invalid, likely due to invalid characters. XML error: not well-formed (invalid token) at line 274, column 32 Any insight would be appreciated greatly! Rob
Technical SEO | | sdwellers0 -
Magento Rewrite Issue
Moz's Crawler has thrown up a bunch of crawl issue for my site.The site is a magento based site and I recently updated the themes so some routes may have have become redundant. Moz has identified 289 pages with Temporary Redirect. I thought magento managed the redirects if I set the "Auto-redirect to Base URL" to Yes(301 Moved permanently). But this is enabled on my store and I still get the errors. The only thing I could think of was to add a Robots.txt and handle the redirection of these links from here. But handling redirection for 289 links is no mean task. I was looking for any ideas that could fix this without me manually doing this .
Technical SEO | | abhishek19860 -
Impact issues when switching from .com to uk
Buon Giorno from wetherby UK 5 degrees C and rivers bursting their banks everywhere 😞 This site http://www.sandtoft.com/ has requested a switch in url forwardfing in that they want the following to happen: When u enter the .com url it forwards to the .co.uk domain (the opposite from what it is today ie when you eneter .co.uk it switches to the .com url) So my question is please... "Will changing the .com url to .co.uk via forwarding affect SERPS in any significant manner" My view is the impact will be a minor dip in the serps followed by a recovery. Any insights welcome 🙂
Technical SEO | | Nightwing0 -
Product Duplicate Content Issue with Google Shopping
I have a site with approx 20,000 products. These products are resold to hundreds of other companies and are fed from one database therefore the content is duplicated many many times. To overcome this, we are launching the site with noindex meta tags on all product pages. (In phase 2 we will begin adding unique content for every product eek) However, we still want them to appear in Google Shopping. Will this happen or will it have to wait until we remove the noindex tags?
Technical SEO | | FGroup0 -
Rel = author display issue
I want to enter some products as blog posts. I don't want users to see the post info, but do want SE's to see rel="author". I can do this by setting display to "none" in a CSS style. The post info does not appear in the browser but is still in the page source. Will search engines be able to see the post info?
Technical SEO | | waynekolenchuk0 -
Re-direct issues
Forgive me for the novice question. But I was recently looking at open site explorer and was checking out my site www.visualawards.com , I know we have a re-direct to www.visualawards.com/home.php . After checking both URL's, I found that I have links pointing to both. Is this bad, am I diluting the links? If yes, which one should I point the future ones to, and is there anyway to recover the current links already? Thanks again for your help!!!
Technical SEO | | RENDEV0 -
Crawl issues/ .htacess issues
My site is getting crawl errors inside of google webmaster tools. Google believe a lot of my links point to index.html when they really do not. That is not the problem though, its that google can't give credit for those links to any of my pages. I know I need to create a rule in the .htacess but the last time I did it I got an error. I need some assistance on how to go about doing this, I really don't want to lose the weight of my links. Thanks
Technical SEO | | automart0