Redirect
-
How do I redirect this url:
Thank you for your help.
-
Hi Keri, you just pushed me to go forward with that problem. Yes, Mike's suggestion works perfect!
-
Hi Mike, sorry for my delayed answer (I have been on holiday in between an this means always busy time before and after... and this item was not the most important one. The problem with my mentioned redirect above has been that it worked, BUT the image itself (which is of course in use on the website) was not visible any more.
And your solution works perfect - I just tried it out. Thank you
-
Petra, did this work for you?
Keri [SEOmoz associate]
-
So I think you are trying to redirect a query parameter request to your home page, right? So that this:
/m/imgres?q=short+holiday+treatments
is redirected to this:
/
Correct? If so, try this:
RewriteCond %{QUERY_STRING} ^(.)short+holiday+treatments(.)$
RewriteRule ^(.*)$ /? [R=301,L] -
Right .. sorry:
~img/head/beauty-spa.jpg%22%20width=%22114%22%20height=%2250%22%20alt=%22image%22/%3E%3C/a%3E%20%3C/div%3E%20%3Cdiv%20class=%22c0%20r%22%3E%3Ca%20href=%22/m/imgres?q=short+holiday+treatments~
I am looking for something like that:
RewriteRule ^img/head/beauty-spa.jpg(.)$ / [R=301,L]
RewriteCond %{QUERY_STRING} ^q=short+holiday+treatments$
RewriteRule (.) /? [R=301,L]But it ain't work
-
the sample code you posted comes through as a whole code fragment with unpaired tags. If you post it between curly braces it should show up better here. Are you looking for the syntax of the regular expression for your case, or something else?
-
Hi Mike - I know this already ;-).
I am asking for that special case.
But thank you for your time.
-
Normally redirects are done in the .htaccess file of your site, using a RewriteRule. Something like this:
RewriteEngine on
RewriteRule ^old.html$ new.htmlGoogle it and you'll find more examples.
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
-
Why does my Google Web Cache Redirects to My Homepage?
Why does my Google Webcache appears in a short period of time and then automatically redirects to my homepage? Is there something wrong with my robots.txt? The only files that I have blocked is below: User-agent: * Disallow: /bin/ Disallow: /common/ Disallow: /css/ Disallow: /download/ Disallow: /images/ Disallow: /medias/ Disallow: /ClientInfo.aspx Disallow: /*affiliateId* Disallow: /*referral*
Technical SEO | | Francis.Magos0 -
CNAME vs 301 redirect
Hi all, Recently I created a website for a new client and my next job is trying to get them higher in Google. I added them in OSE and noticed some strange backlinks. To my surprise the client has about 20 domain names. All automatically poiting to (showing) the same new mainsite now. www.maindomain.nl www.maindomain.be
Technical SEO | | Houdoe
www.maindomain.eu
www.maindomain.com
www.otherdomain.nl
www.otherdomain.com
... Some of these domains have backlinks too (but not so much). I suggested to 301 redirect them all to the main site. Just to avoid duplicate content. But now the webhoster comes into play: "It's a problem, client has only 1 hosting account, blablabla...". They told me they could CNAME the 20 domains to the main domain. Or A-record them to an IP address. This is too technical stuff for me. So my concrete questions are: Is it smart to do anything at all or am I just harming my client? The main site is ranking pretty well now. And some backlinks are from their copy sites (probably because everywhere the logo links to the full mainsite url). Does the CNAME or A-record solution has the same effect as a 301 redirect, from SEO perspective? Many thanks,
Hans0 -
.htaccess redirects
I've done some research but can't find a good answer to this question. Here's my situation: Site redirects from example.com to www.example.com just fine. However, it doesn't work so well for internal pages. My site incorrectly redirects (non-www) example.com/page2 to www.example.com when it should instead go to www.example.com/page2 So I need a method to redirect non-www internal pages to www versions. Currently I have this in my .htaccess - do I need to modify the rules? RewriteEngine on
Technical SEO | | 3plains
RewriteCond %{HTTP_HOST} !^www.example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L] Thanks0 -
Redirects in site map
I have a site with the ace/sef ( creates friendly URLS) in a large data base site. It creates a site map dynamically. Yet I realize one issue which I am trying to think through. I recently changed my urls to include an ID number example: homepage/houses/1134-big-blue-house The prior url was: homepage/houses/big-blue-house the original url above redirects to the new one with the ID like I want. However the site map has both URLS in it which go to same page I am not sure but it seems rather stupid to have the new URL and OLD redirected URL in the site map. Yet beside stupid I am wondering if this is duplicate content and will cause a penalty from the google bot. What is your opinion ?
Technical SEO | | aimiyo0 -
Does redirect of domain alias help rankings?
Yes... It iz I again ;o) Here's one for you savy techies out there: So, I've got a primary domain which is live, optimized and running smooooth. And then I've got a couple of misspelled domains as well (17 to be exact). Will it have an effect if I 301 those misspelled domains? What's Best Practice for several domain aliases? Example.
Technical SEO | | nosuchagency
Primary domain: bryghusprojektet.dk
Alias domain 1: bryghusprojekt.dk (301 redirects to primary domain)
Alias domain 2: bryghus-projekt.dk (Hosting company infopage)
Alias domain 3: bryghus-projekter.dk (Not activated) Regards.1 -
Redirects
If I redirect page A to page B does page A need to exist before Google sees the redirect. Or can I just put up a redirect and delete page A. If the page doesn't need to exist: You have all your redirects in place for a website. You want this website to redirect to another website. You completely delete the website and put up the htaccess, there should be no problem with this, because the redirects are in place correct? Thanks
Technical SEO | | tylerfraser0 -
IIS Work Around 301 Redirects
We are redirecting page-level content (about 500 pages) from several sub domains to our main site. With IIS, It’s my understanding that file locations must match. For example: subdomain/pathA/filename1
Technical SEO | | DigitalMkt
mainsite/pathA/filename1 Since the sub domain files are not on the main site, this means we'd create up to 500 zero byte dummy files on the new server and replicate the sub domain directory structure. With IIS is there a work around for handling page level redirects without duplicating the file location? In the case of white papers, videos and case studies, we'll imlement directory level redirection. Thanks in advance.0 -
301 Redirect NOT Working as Expected - HELP!
Hi! I just launched our newly coded site and just realized the installed 301 is NOT working. The URL string is the same EXCEPT for the removal of /shop/. Here is the code in .htaccess: ############################################ enable rewrites Options +FollowSymLinks RewriteEngine on #RedirectMatch 301 ^/shop?/$ http://hiphound.com/ RedirectMatch 301 ^/shop?/$ http://hiphound.com ########################################### When I go to Google and click on an old link I get a 404. No bueno!! Here is an example: http://hiphound.com/shop/rubit-dog-tag-clip I thought (and was told) that the installed 301 would send this page to: http://hiphound.com/rubit-dog-tag-clip It's not. Please HELP!! 🙂 What am I doing wrong??? Lynn
Technical SEO | | hiphound0