Change name of directory
-
How can I best change the name of a directory on my website (example: http://www.website.com/nameofdirectory/)?
The directory has lots of content included in it which has links from all over my website. I guess I have to adjust those links? How do I easily collect all of the links?
Which is the code I should use in my htacces?
Thank you!
With kind regards,
Dieter -
A 301 is the code returned by your web server, along with the address of the new page. htaccess (mod_rewrite) is the most powerful tool to do this because it uses regular expressions to filter (which, consequently, also makes it more difficult to use).
You don't have to use htaccess, however. Virtually all server-side programming languages (like PHP, .NET, Ruby on Rails, etc) support telling Apache what headers to return. Here's a PHP example
header("HTTP/1.1 301 Moved Permanently");
header("Location:http://www.newsite.com");
exit(); -
You can use a text editor like Notepad++ for it.
-
Is there a software I should use for "Search & Replace"?
-
Download the website and do a search and replace for nameofdirectory to new****nameofdirectory. That should take care of it. Along with that put a 301 in place for any external links going to nameofdirectory. You should be good.
-
I just dont see how I can add a 301 redirect to a page. I thought I could only add it in .htaccess?
How about the pages on my website that link to the old directory?
-
The website itself is static but the directory is a CMS. What would be the best option then?
-
The same principle applies to all rewrites. You can rewrite one page, an entire directory or even your whole site. htaccess is one of Apache's best features and that's why every web server out there offers some version of it.
If I'm still not answering your question then please supply some more details and I can go more in depth.
-
Is your website static or uses some sort of a CMS ? It might be possible to do a search and replace for nameofdirectory or newnameofdirectory and that should work. I would also recommend doing a directory level 301 redirect via .htaccess that will redirect http://www.website.com/nameofdirectory/* to http://www.website.com/new****nameofdirectory/*
//301 Redirect Entire Directory RedirectMatch 301 /nameofdirectory(.*) /newnameofdirectory/$1
-
@ Highland: It is not a page, it is a directory.
-
You need to add a 301 redirect to your new page. This will send a command to your browser (and any bots) to go to the new page. This page describes how to modify your htaccess file.
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
-
WooCommerce category naming conventions
I am managing a woocommerce store selling prescription glasses/spectacles. We have a lot of categories with similar names and I want to adopt the best possible naming convention to get the best from search. So we have a number of similar categories for both Men's and women's glasses. Currently they are named as follows: Women's Glasses-Women's Rimless Glasses
Technical SEO | | SushiUK
-Women's Semi Rimless Glasses
-Women's Plastic Glasses
-Women's Metal Glasses
-Women's Retro Glasses Currently, this results in the following URL structure for sub categories: https://www.glassesonspec.co.uk/product-category/womens-glasses-2/womens-rimless-glasses/ (For some reason WooCommerce is adding -2 to the end of the primary category name, it will not let me change it for some reason, this is the subject of a further investigation!) So first question, is there too much duplication of the word glasses on the sub items? for example, should they read; Women's Glasses
-Rimless
-Semi Rimless
-Plastic
-Metal
-Retro Hence giving this URL structure: https://www.glassesonspec.co.uk/product-category/womens-glasses-2/rimless/ OR, should we change the top level category name to just Women's and let the sub categories complete the picture?: Women's
-Rimless Glasses
-Semi Rimless Glasses
-Plastic Glasses
-Metal Glasses
-Retro Glasses Giving this example URL structure: https://www.xxxxxxxxxxxxx.co.uk/product-category/womens/rimless-glasses/ This would solve my hyphenation problem, however my fear is the top level category on it's own is not descriptive enough when viewed as stand alone: https://www.xxxxxxxxxxxxx.co.uk/product-category/womens/ The second part of my question relates to how to deal with the change in URL structure. I am using Yoast Premium, so will that pick up the changes and automatically redirect to the new one as it does when done manually? Or will I need to take a different approach using HTACCESS commands? I hope the above makes sense, Many thanks, Bob0 -
Changed site to https now GWT and analytics - do I Know have to re-add it
Hi had the previous version (wordpress) site in GWT working just fine - now everything seems to have stopped. Do I have to treat this as an entirely new site and now add a new account for the https version? Many thanks,
Technical SEO | | AndreavanEugen0 -
Brand name as H1 on every page
Hi, Along with the title of each page, a Wordpress client has their brand name as a H1 on every single page. This is situated in the footer and just sits within the company info/address. Should these tags be removed, leaving just the page titles as H1s? Cheers, Lewis
Technical SEO | | PeaSoupDigital0 -
Changing URIs
About 2 months ago, my client changed its domain—using 301 redirect—and took the hit in search results. Here's my question: If I convince the client to revert to their old URI, will that help or hurt their SEO? Follow-up, can it hurt to change interior URIs to something that better reflects the page content? Thanks.
Technical SEO | | mollykathariner_ms0 -
Google Change of Address with Questionable Backlink Profile
We have a .com domain where we are 301-ing the .co.uk site into it before shutting it down - the client no longer has an office in the UK and wants to focus on the .com. The .com is a nice domain with good trust indicators. I've just redesigned the site, added a wad of healthy structured markup, had the duplicate content mostly rewritten - still finishing off this job but I think we got most of it with Copyscape. The site has not so many backlinks, but we're working on this too and the ones it does have are natural, varied and from trustworthy sites. We also have a little feature on the redesign coming up in .Net magazine early next year, so that will help. The .co.uk on the other hand has a fair few backlinks - 1489 showing in Open Site Explorer - and I spent a good amount of time matching the .co.uk pages to similar content on the .com so that the redirects would hopefully pass some pagerank. However, approximately a year later, we are struggling to grow organic traffic to the .com site. It feels like we are driving with the handbrake on. I went and did some research into the backlink profile of the .co.uk, and it is mostly made up of article submissions, a few on 'quality' (not in my opinion) article sites such as ezine, and the majority on godawful and broken spammy article sites and old blogs bought for seo purposes. So my question is, in light of the fact that the SEO company that 'built' these shoddy links will not reply to my questions as to whether they received a penalty notification or noticed a Penguin penalty, and the fact that they have also deleted the Google Analytics profiles for the site, how should I proceed? **To my mind I have 3 options. ** 1. Ignore the bad majority in the .co.uk backlink profile, keep up the change of address and 301's, and hope that we can just drown out the shoddy links by building new quality ones - to the .com. Hopefully the crufty links will fade into insignificance over time.. I'm not too keen on this course of action. 2. Use the disavow tool for every suspect link pointing to the .co.uk site (no way I will be able to get the links removed manually) - and the advice I've seen also suggests submitting a reinclusion request afterwards- but this seems pointless considering we are just 301-ing to the new (.com) site. 3. Disassociate ourselves completely from the .co.uk site - forget about the few quality links to it and cut our losses. Remove the change of address request in GWT and possibly remove the site altogether and return 410 headers for it just to force the issue. Clean slate in the post. What say you mozzers? Please help, working myself blue in the face to fix the organic traffic issues for this client and not getting very far as yet.
Technical SEO | | LukeHardiman0 -
Changing Domain Registrars have an affect on rankings?
So, I just wanted to move my domain from GoDaddy to NameCheap. I am still thinking about the move as I am not sure what affect it will have on my rankings. Has anyone here done it before? Did you see any drop in rankings? Also, while I was at it - I was thinking maybe I can add WhoisGuard too. I am not too paranoid about people getting my info from WhoIs, but does having a private Whois have an affect on ranking?
Technical SEO | | uzair0 -
Changing url structure
We are an ecommerce site established in 2005 and currently have some great rankings. We are about to move away from our existing platform, actinic and move on to Magento. This will change all our url's. What are the steps we should be asking our web developers to follow in order to minimize the consequences of moving? Thank you.
Technical SEO | | LadyApollo0 -
How to 301 multiple domain names to a single domain
Hey, I tried to find and answer to this seemingly simple question, but no luck. So, I have one domain name with a website attached to it. I also registered all the other domain names that are similar to it or have different extensions - I want to redirect all the other domain names to my one main domain name without getting penalised by the big G. It looks like this: www.mainsite.com - this is my main domain I also have www.mainsite.com.au, www.mainsite.org, and www.mainsite.org.au which I all want to just redirect to www.mainsite.com I have been told that the best way to do this is a 301 redirect, but to do that you need to make a CNAME for all the other domains that points to www.mainsite.com. My problem is that I cannot seem to create a CNAME record for http://mainsite.com - I have it working for http://www.mainsite.com but not the non www record. What should I be doing differently? Is it just my DNS provider is useless? Thanks, Anthony
Technical SEO | | Grenadi0