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
-
Root domain change - how do we best handle existing backlinks from our own content platforms on youtube, etc?
Hi, we have recently changed our brand name after 7 years and have changed our root domain to match (33shake.com since 2012, now 33 fuel.com) The site is the same (no migration to a new one) as there were no other business changes apart from the name/domain. 301 redirects are looking after all former 33shake.com links, which are now being redirected to their new 33fuel.com equivalents (slugs are the same in 99% of cases). My question is: We have a lot of backlinks for our old domain (33shake.com) on our own content via our YouTube channel (100+ videos) and also our podcast (64 episodes in, broadcast on 10 platforms). For maximum SEO benefit as we continue to restore domain authority, etc to 33fuel.com, are we best to leave these historical backlinks pointed at the old domain and let the redirects pick them up when people click? Or are we better off swapping all of these old historical backlinks so they point directly to the new domain? Any advice would be greatly appreciated, this is quite a maze we are now picking our way through! Warren
Technical SEO | | WP331 -
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 -
SEO implications when changing the business function however using the same domain name
Hi Everyone, Request some advice on the following situation please: If a client wishes to start a new business (advertising agency) using a domain name that they previously used for a completely different business function (selling hats & t-shirts) Is there anything you can do to "clean" the domain so that the previous indexing of the domain does not effect the new business and give the client a fresh start. Any help or advice would be greatly appreciated. Regards and thanks.
Technical SEO | | Republica0 -
Value of domain name for domain authority. Please help to figure out!
I am doing SEO for an appliance repair company. Their company website's domain doesn't have high authority, and I am going to increase that by link earning and content improving. I think a better domain name might also help me out. The current URL contain the word "appliance" but doesn't have "repair" in it. I am thinking a new domain that would contain both keywords will serve better. Could you please share with me your thought on this? Am I in the right direction, or not at all? I know Google penalizes mirror sites since this they are considered as duplicated content. I'll upload my content to the new domain and make the old one point to that new URL. I am wondering if canonical might help? Or 301 redirect will be a better solution? Any advise would be highly appreciated! Thank you!
Technical SEO | | kirupa0 -
Changing URLs for SEO
Hi, Currently we have a page, /business, but we have shifted our strategy to optimize for this page for the keyword "enterprise" instead of "business". The page authority of this page is 18 and our domain authority is 35. I've already updated content and title tags to more of an enterprise focus. Would it be wise to move the page to /enterprise and create a 301 redirect from /business to /enterprise? Or is this too risky from an SEO standpoint? Thanks!
Technical SEO | | mikekeeper0 -
Using the word "FREE" in domain name
Hi, This may seem like a simple question but a new client of mine wishes to use a domain name with the word "free" in it. The website will offer free activity vouchers. I couldn't see this being a problem as there a lot of websites that do this although he was told it may present a problem with the search engines thinking the site was spammy. It won't be and will be offering information and vouchers on local sporting activities. I was wondering if anybody could clarify this please so I can give him a more definitive answer to his question. Thanks for your help.
Technical SEO | | malinkymedia0 -
Best way to change from one CMS to wordpress??
I have a client that was working with another SEO consultant and they pretty much dropped the ball big time! The SEO company took his site off of wordpress and put it on another CMS (http://www.wsinetsuccess.com/WSI-E-Fusion). My client would like to take hes site off of the WSI E Fusion platform and back onto wordpress. My question is how is the best way to going about doing this with out loosing all of the PR to the site? Should I find all of the URLs that are on the site and just 301 them to the right page? Thank you very much for your help.
Technical SEO | | pakevin0 -
What is the best way to change your sites folder structure?
Hi, Our site was originally created with a very flat folder structure - most of the pages are at the top level. Because we will adding more content I want to tidy up the structure first. I just wanted to check what the best way to go about this was. Is it best to: First configure all the new 301 redirects to point to the new pages, while leaving the actual links on our site pointing to the old pages. Then changing the links on the site after a few weeks. Configure the redirects and change the actual links on my website at the same time to point to the new locations. My thinking that if I go with option 1 route then I will give Google a chance to process all the redirects and change the locations in their index before I start pointing them to the new locations. But does it make any difference? What is the best wat to go about making this sort of change to minimize any loss in rankings, page rank etc? Thanks for the help.
Technical SEO | | Maximise0