301 redirects.
-
Hi everyone,
I am having some issues with an a few dynamic URLs that are not redirecting;
Example:
I first tried to carry out a standard 301 which looked like this;
Redirect 301 /longurlwith&category_id=303 http://www.example.com/new-url
Which didn't work. After a little bit of research I added the following into the htaccess file;
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]RewriteRule ^/shop-online$(.*)$ http://www.example.com/shop-online$ [NE,L,R=301]
Which caused the website to error 500 (Not cool).
So now I am stumped. Any help would be really appreciated as I'm sure it's an easy fix but I can't quite my finger on it.
Thanks in advance :).
-
Hi Adam
Yes you are correct as your query string is changing and so is the page you are directing to.
-
Hi there,
i agree with matt but it could also be that the end of the redirect tag would be [R=301,L] in stead of [L,R=301]. This depends on the server. I had it happen to me a copple of times. Makes you question a lot of things and in the end it is as simple as this.
hope this helps
Matt +1
Jarno
-
Hi Adam,
Try this:
RewriteCond %{QUERY_STRING} ^everything-after-the-question-mark$ RewriteRule ^shop-online$ http://www.new.com/new-page? [L,R=301]
so above would be
Options +FollowSymlinks RewriteEngine On
RewriteCond %{QUERY_STRING} ^page=shop.product_details&flypage=flypage_images.tpl&product_id=69164&category_id=303$ RewriteRule ^shop-online$ http://www.new.com/new-page? [L,R=301]
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
-
How long should I keep the 301 redirect file
We've setup an new site and many pages don't exist anymore (clean up done). But for many of them we have new pages with new url's. We've monitored the 404 and have now many URL's redirected with 301 (apache file). How long should we keep this in place? Checking all links manually to see of new url is in place of the old url (in google) is too much work. tx!
Intermediate & Advanced SEO | | KBC0 -
Can 301 redirects that are inaccurate cause Google suppressions on rankings?
In an interesting study by DeganSEO titled 'Negative Impact of 301 Redirects - A Case Study' a drop of rankings was observed when popular blog posts were redirected to product pages. One hypothesis is that the suppression is due to topical difference between the redirected pages (blog posts) and the target page. The topical difference issue is an interesting one when you consider it in the context of website migrations. We always recommend that 301 redirects are done at a page level and that if an equivalent page doesn't exist to just 301 anyway but to the most logical page. If you think about it Google are likely to frown on this because a) it's not a good experience for the user - 404 would be more accurate for them
Intermediate & Advanced SEO | | QubaSEO
b) it's lazy - if you have good content that has gained authority/trust then create the same content on the new site don't trytp pass that to an entirely different page. Thoughts? Experiences?0 -
Multiple 301 redirects for a HTTPS URL. Good or bad?
I'm working on an ecommerce website that has a few snags and issues with it's coding. They're using https, and when you access the website through domain.com, theres a 301 redirect to http://www.domain.com and then this, in turn, redirected to https://www.domain.com. Would this have a deterimental effect or is that considered the best way to do it. Have the website redirect to http and then all http access is redirected to the https URL? Thanks
Intermediate & Advanced SEO | | jasondexter0 -
Can an incorrect 301 redirect or .htaccess code cause 500 errors?
Google Webmaster Tools is showing the following message: _Googlebot couldn't access the contents of this URL because the server had an internal error when trying to process the request. These errors tend to be with the server itself, not with the request. _ Before I contact the person who manages the server and hosting (essentially asking if the error is on his end) is there a chance I could have created an issue with an incorrect 301 redirect or other code added to .htaccess incorrectly? Here is the 301 redirect code I am using in .htaccess: RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/.]+/)*(index.html|default.asp)\ HTTP/ RewriteRule ^(([^/.]+/)*)(index|default) http://www.example.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} !^(www.example.com)?$ [NC] RewriteRule (.*) http://www.example.com/$1 [R=301,L] Could adding the following code after that in the .htaccess potentially cause any issues? BEGIN EXPIRES <ifmodule mod_expires.c="">ExpiresActive On
Intermediate & Advanced SEO | | kimmiedawn
ExpiresDefault "access plus 10 days"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/plain "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType application/x-icon "access plus 1 year"</ifmodule> END EXPIRES (Edit) I'd like to add that there is a Wordpress blog on the site too at www.example.com/blog with the following code in it's .htaccess: BEGIN WordPress <ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]</ifmodule> END WordPress Thanks0 -
Htaccess redirect veriables
Hey, I'm trying to redirect all instances of "/archive_details.php?id=*" to "/public-affairs-job-archive.php". Is the below code correct? Redirect 301 /archive_details.php?id=* /public-affairs-job-archive.php Thanks, Luke.
Intermediate & Advanced SEO | | NoisyLittleMonkey0 -
Effect SERP's internal 301 redirects?
I'm considering installing Wordpress for my website. So I have to change the static URL's from /webpage.html to /webpage/. Yet I don't want to lose in the SERP's. What should I expect?
Intermediate & Advanced SEO | | wellnesswooz1 -
Duplicate titles but redirecting anyway (without redirects set up!!!)
Google has done a crawl of my site and is flagging up duplicate titles on my wordpress site. This appears to be due to the face that some posts are tagged in more than one category. I have just gone to make sure that each post just has one category and add redirects and I've noticed that all the duplicate title issues google has notified me about appear to redirect anyway. For example: http://www.musicliveuk.com/latest-news/live-music-boosts-australian-economy and http://www.musicliveuk.com/live-music/live-music-boosts-australian-economy have duplicate titles apparantly but the 1st url redirects to the 2nd one. I use the redirection plug in but have no redirection set up for that url so I'm a bit confused. And if they're redirecting anyway then why is google flagging up duplicate titles? Any help would be much appreciated.
Intermediate & Advanced SEO | | SamCUK1 -
301 redirects from old to new pages whit a lot of changes
Hello all, We are going to restyle and change CMS so all the urls will change. We are also updating content, adding much more content to the old pages trying to be more user and SEO friendly. My doubt is about doing 301 redirects from old to new pages when the content has changed a lot. Does it will mantain the ranking of the page or will crawlers thought that is a total diferent page. For example: one page new page will change from the old one the url, title, headers, meta description, content text and images. Should i maintain old content and do the CMS change with the 301 redirects and later change the content, that means a lot of work, or do it all at once? Thanks in advance Tomas
Intermediate & Advanced SEO | | tomas.guemes0