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
-
Using Temporary Redirects for Ecommerce Categories?
Hi I'm currently going over old category pages for an ecommerce website, and I'm trying to work out the best way of handling old pages. I will be setting up 301s for the majority of pages, as these are 100% dead and gone. I'm struggling a bit with certain pages though, whereby the category is empty but there is always the possibility that our buyers will purchase these products again in the future (or they might not, there's no way to tell). I know that this isn't what a 302 is for, but I'm wondering which would be better in this case: to create a 302 redirect or to do a full 301 and if the products are repurchased at a later date to create a whole new url. Hope that makes sense. Thanks, Kate
Technical SEO | | Lisaangel0 -
Redirect Chain Domain
MozPro is highlighting some redirect chain issues with our domain that I do not recall ever setting up in our redirect list. In our Moz Pro Campaign I see the Site Crawl has flagged 36 Redirect Chain Issues. I understand how the redirect chain errors can happen but I do not recall ever manually redirecting our domain, yet I have http://stickylife.com, https://stickylife.com & https://www.stickylife.com all associated in one of our redirect chain errors. When looking at our redirect files I do not see any of these domain redirects and wonder how this has happened and how to fix it. It appears as though our HTTP and HTTPS is causing some redirection. I wonder if this is coming from our DNS settings?
Technical SEO | | StickyLife0 -
301 Redirecting http to https
In the Moz Site Crawl issue, I was seeing an error that said we were temporarily redirecting our homepage to https URLs. So I changed the code in htaccess to make it 301 redirect but I'm still getting the same error. I implemented it last week and we just had a new crawl yesterday. Here is the new code: RewriteEngine on
Technical SEO | | Heydarian
RewriteCond %{HTTP_HOST} ^heritagelawmarketing.com [NC]
RewriteRule ^(.*)$ http://www.heritagelawmarketing.com/$1 [L,R=301,NC] Does anyone know why I'm still getting 302 redirects? Thanks0 -
CGI Redirects
Trying to 301 old legacy files like oldsite.com/green/red.cgi/blue/ using this htaccess code: Redirect 301 /green/red.cgi/blue/ http://www.newsite.com/summary-page/
Technical SEO | | SoulSurfer8
Instead it's redirecting to: newsite.com/red.cgi/blue/ FYI oldsite.com's htaccess file does not have any global 301 rules that would conflict Does anyone know if cgi files require a different 301 syntax? Thanks!0 -
To 301 redirect or not...
Hi guys i'd like to get your opinion on this. We currently have two sites, site A is the old one with PA44 and DA33. Site B is the new one which is going to replace site A it currently has PA37 and DA24 Our plan for the future is to shut down site A and redirect all pages using 301 to the relevant pages on side B. Currently we have some links in place for a couple of keywords on site A to site B which seems to be working great for our ranking. Now i'm wondering if this is maybe a good option, to give back links from A to B or will i pass through more link juice when redirecting everything? (ps. both are e commerce sites hosted and registred with different companies)
Technical SEO | | Immanuel0 -
How can I perform this 301 redirect?
I am working on a site for a colleague and have installed wordpress on their server in the wp directory, they want the root domain redirecting to the wp directory but everything i have tried seems to throw up errors. i need sample.co.uk to redirect to sample.co.uk/wp/ no matter which html file they are trying to access on the root of the sample.co.uk site help?
Technical SEO | | GrassRootsSEO0 -
Apache redirects
Hey all I'm handling some redirects and am fuzzy with Apache server stuff. I'm redirecting dynamic URLs and the only thing that's changing is the new domain. I have implemented this in the server file (thus far unsuccessfully): RewriteEngine on
Technical SEO | | jamesm5i
RewriteCond %{HTTP_HOST} ^.oldsite.com$ [NC]
RewriteRule ^(.)$ http://www.newsite.com/$ [L,R=301] Any ideas on what I can change to make it work? For those who are more familiar I know I'm missing something simple. Thanks as always!0 -
Redirect Multiple Domains
This is a follow-up question from one posted earlier this month. I can't linked to that because it's a private question so I'm trying to summarize it below. We have a number of domains – about 20 - (e.g. www.propertysharp.com) that point to our main domain ip adress (www.propertyshark.com) and share the same content. This is no black-hat strategy whatsoever, the domains were acquired several years ago in order to help people who mistyped the websites url to reach their desired destination. The question was whether to redirect them to our main domain or not. Pros were the reportedly millions of incoming links from these domains - cons was the fact that lots of issues regarding duplicate content could arise and we actually saw lots of some pages from these domains ranking in the search engines. We were recommended to redirect them, but to take it gradually. I have a simple question - what does gradually mean - one domain per week, per month?
Technical SEO | | propertyshark0