Help with 301 redirect code
-
Hi,
I can't work out how to make this one work and would apreciate if someone could help.
i have a series of folders from a old site that are in the structure:
/c/123456/bags.html (the "123456" changes and is any series of 6 digit numbers), and the "bags.html" changes depending on the product.
I need that to be 301 redirected to the following format:
/default/bags/bags.html -
Hi Paul,
As Andy mentioned earlier, the complexity here comes by the fact that these IDs cannot be simply removed since they play a role in the Magento product/category system.
The first step would be that you identify how these are generated to identify the best way to optimize it to become relevant or at least doesn't add more depth and complexity in the URL structure.
I've seen that there's a URL rewrite area in Magento with some system configuration options that you might want to take a look here and to this in-depth guide explaining Magento URL rewrites.
I've also seen that a similar question has been asked in Stackoverflow and as you can see the potential alternatives discussed here goes into Magento's system configuration.
Hope this helps!
Aleyda
-
no worries Andy, I really appreciate you trying
-
it would be hard to do without knowing the system really well, though that plugin maybe able to help. The reason is that if those codes change they could mean any category - the last bit is likely not an issue of product name as url, but the category bit isn't so easy - unless it can be ignored and pulled from the CMS - again not being a magento expert I don't know how this would be done. sorry.
-
Thanks Andy, i'll take a look.
I'm no htaccess guru, but was hoping that there was some sort of wildcard that could:
find "any product" (eg bags.html) in categories /c/123456/ and redirect to /default/bags/i just can't get my head around it. Is there a * or ? or combination? as it would need to pick up the changing 6 digits
-
oh erm sounds a little odd set up - maybe worth trying http://shop.ecomdev.org/url-rewrite-indexer.html
-
thanks guys.
Andy...
yes, i need the new format to be /default/category/bags.html (but the bags.html will vary with whatever the original product is).
The category has no relation to the new category. It was generated by a old cms system and seems to fluctuate.
Yes, it is a Magento shopping cartTom,
yes, it is .htaccess>
I have added some other 301 redirects successfully, but can't work out how to change the 6 digit category, while still making sure the end product (eg bags.html) redirects to bags.html in the new structure.I hope that makes sense?
Thanks
Paul -
Hi there
First of all, does your site use an .htaccess file? This is probably the most common solution used to implement 301 redirects. The SEOMoz guide to redirection is really useful in explaining how to implement redirects for apache servers and others.
These three generators can create the code for you, but it's very important to learn how the .htaccess file works before trying to implement it. Therefore, you should acquaint yourself fully with the Moz guide linked above.
Alternatively, if your site is running WordPress, you can setup 301 redirects very easily with the Yoast SEO plugin.
Hope these resources help.
-
ok this needs clarifying
so your old urls want to be of the format /default/category/bags.html yes?
does the category relate to the 6 digit number in some way?
Are you using a shopping care of some kind or is this a bespoke system?
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
-
301 Redirects
Hello, All. Hopefully this will be an easy question for some of you. I have a (WordPress) site with the format of: http://www.site.com/folder-old/page-old/ I have since re-named both the parent and sub-folders to (example): http://www.site.com/folder-new/page-new/ Everything is working well EXCEPT I am also trying to redirect visitors from the old URL/structure to the new. I have a 301 redirect setup as the following: Redirect 301 /folder-old/page-old/ http://www.site.com/folder-new/page-new/ -- But it doesn't seem to be working. Not sure if this is something finicky with WordPress or if the redirect is incorrect. Thank you.
Technical SEO | | BrandBuilder0 -
Homepage 301 and SEO Help
Hi All, Does redirecting alternate versions of my homepage with a 301 only improve reporting, or are there SEO benefits as well. We recently changed over our servers and this wasn't set-up as before and I've noticed a drop in our organic search traffic. i.e. there was no 301 sending mywebsite.com traffic to www.mywebsite.com Thanks in advance for any comments or help.
Technical SEO | | b4cab0 -
Best & easiest way to 301 redirect on IIS
Hi all, What is the best and easiest way to 301 redirect URLs on IIS server? I got access to the FTP and WordPress back office, but no access to the server admin. Is there an easy way to create 301 redirect without having to always annoy the tech in charge of the server? Thanks!
Technical SEO | | 2MSens0 -
Index.php and 301 redirect with Joomla
Hi, I'm running Joomla 1.7 with SEF on and I'm trying to do a htaccess redirect which fails. I have approximately 100 in effect so far and all working fine, but I have one snag. Index.php is not working as I need it to when it's redirected to www.myurl.com/ If I turn on index.php redirect to root using this code #index.php to root
Technical SEO | | NaescentAdam
RewriteCond %{HTTP_HOST} ^myurl.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.myurl.com$
RewriteRule ^index.php$ "http://www.myurl.com/" [R=301,L] And then go to www.myurl.com/test.html I'm redirected to the homepage. I think this is because all pages are index.php in joomla. SEOMOZ and Google both think that index.php and root are duplicate pages. Does anyone have any advice for overcoming this? Thanks, Adam0 -
Does it really matter to maintain 301 redirect after de-indexing of old URLs?
Today, I was reading latest blog post on SEOmoz blog about. Uncrawled 301s - A Quick Fix for When Relaunches Go Too Well This is very interesting study about 301 & How it useful to maintain traffic. I'm working on eCommerce website and I have done similar stuff on my website. I have big confusion to manage 301 redirect. My website generates new URLs due to following actions. Re-write dynamic URLs. Re-launch entire website on different eCommerce platform. [osCommerce to Magento Commerce] Re-name category. Trasfer one product from one category to another category. I'm managing my 301 redirect with old practice. Excel sheet data from Google webmaster tools and set specific new URLs for redirect. Hoooo... Now, I have 8.5K redirect in htaccess... And, I'm thinking it's too much. Can we remove old 301 redirect from htaccess or not? This is big question for me. Because, all pages are not hyperlink on external website. Google have just de-indexed old URLs and indexed new URLs. So, Is it require to maintain 301 redirect after Google process?
Technical SEO | | CommercePundit0 -
301 redirect domain to page on another domain
Hi, If I wanted to do a 301 permanent redirect on a domain to a page on another domain will this cause any problems? Lets say I have 4 domains (all indexed with content), I decide to create a new domain with 4 pages, one for each domain. I copy the content from the old domains to the relevant page on the new domain and set it live. At the same time as setting the new site live I do a 301 permanent redirect on the 4 domains to the relevant pages on the new domain. What happens if Google indexes the new site before visiting the redirected domains, could this cause a duplicate content penalty? Cheers
Technical SEO | | activitysuper0 -
301 Redirects
Hello, I have a problem with my website. I have a page on my website http://www.ensorbuilding.com/page.php/aboutus but if i type in www.ensorbuilding.com/page.php/aboutus/f8e45e9d9df6140bb5a7ff1173e8d828 or www.ensorbuilding.com/page.php/aboutus/0f0eea5e9ab0a3e8d91fad8fc0d3ce9c it still displays the about us page. Google is seeing this as duplicate content so what I would want to do is 301 redirect anything after www.ensorbuilding.com/page.php/aboutus . How could I implement a 301 redirect in this way?
Technical SEO | | danielmckay70 -
Wordpress 301 redirects
I use wordpress as CMS on a few sites and I noticed that word press automattically places 301s if I change a url etc. I believe it does it by having the following in the .htaccess file: BEGIN WordPress<ifmodule mod_rewrite.c="">RewriteEngine OnRewriteBase /RewriteRule ^index.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</ifmodule> END WordPress Should I use this? I feel like it limits my control over the 301s.
Technical SEO | | mmaes0