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
-
Old site name showing in SERPs
Hi all, We've recently re-launched one of our sites with a substantial redesign, refreshed content, meta data, descriptions and functionality. We noticed in SERPs that some of the page titles are showing the old name for the site, which hasn't been used for a few years and the site's been through a few updates and a URL change since then. All the meta titles showing up as they should in crawls through Search Console and Moz and it's my understanding that if Google were pulling a cached version of a title it would have gone for a more recently cached one? Any thoughts on why Google's turned back the clock on our site's name would be greatly appreciated! -Jamie
Technical SEO | | JamieCMF0 -
What is the risk of changing underscores to hyphens in URLs that are ranking
Client wants to change URL structure from underscores to hyphens - reason for doing this is a cosmetic move. What is the risk of changing underscores to hyphens for URLs that that have been around since 2012 and have a lot of keywords ranking in the top 5 in the SERPS? When the created the site - they structured the URL using dashes and underscores. Here is an example of what an URL looks like: /programs-degrees**/clinical-psychology/clinical_phd_kansas****-city****/** *This page ranks for many high volume keywords in the top 5 of the SERPS. I have started to compile a list on why the URL should not be changed... Building trust and authority from scratch 301 redirects do not pass 100% of the link juice 301 redirecting from underscored to hyphenated versions of the same content is an unnecessary risk to some of that link equity. Good chance rankings/traffic will drop because of the URL change
Technical SEO | | The-frank-Agency0 -
How to tell when a directory backlink or other backlink is worthy of disavow tool? Especially when a keyword is not ranking passed where it should.
Hello, I jumped aboard as SEO for a client, who seems to of had been hit by panda and penguin back in 2012 of April, the panda part I feel I've fixed by creating better content, combining pages that were same topic into one, basically creating a better content experience that relates better to search terms users are searching for. Once the site was redesigned and relaunched all keywords improved minus one, the main keyword they want to rank for. Created a landing page for it, that is very nicely optimized for that keyword and it's brothers and sisters, however that page isn't used by google since it's brand new with a PA of 1. Doing a backlink audit I found 102 links out of 400 using the same anchor text as the keyword they want ranked for, they also have synonyms anchor text for other links too but not quite as much. Most of those 102 domains using the main keyword anchor text are directories, in my opinion I'd declare all of them spam, however there are a few with DAs higher than 50, making me little more nervous to disavow, since I want to make sure we get out of the penalty if we were hit by penguin but also don't want to ruin the ranking for other keywords we're doing better with, since they are longtails and short, but very relevant to users. How is the best way to determine if a site / directory is spammy enough that it's penalizing you and how could I approach the anchor text issue with backlinks? 99% of these links I cannot have changed, since they're directories I doubt many have had a human mess with them in a while. Sidenote* If you're going to post a link as a response, try to summarize what that link will be about, as many times links are giving as an answer but end up not really providing the meat we were seeking. Thank you!
Technical SEO | | Deacyde0 -
Pages Indexed Not Changing
I have several sites that I do SEO for that are having a common problem. I have submitted xml sitemaps to Google for each site, and as new pages are added to the site, they are added to the xml sitemap. To make sure new pages are being indexed, I check the number of pages that have been indexed vs. the number of pages submitted by the xml sitemap every week. For weeks now, the number of pages submitted has increased, but the number of pages actually indexed has not changed. I have done searches on Google for the new pages and they are always added to the index, but the number of indexed pages is still not changing. My initial thought was as new pages are added to the index, old ones are being dropped. But I can't find evidence of that, or understand why that would be the case. Any ideas on why this is happening? Or am I worrying about something that I shouldn't even be concerned with since new pages are being indexed?
Technical SEO | | ang1 -
Remove Directory In Webmaster Tools
Hey Moz'erz, I'm removing some URLS from the index and want to confirm the use of the "remove directory" request. If my structure is this: /blogs/customer-success-stories/tagged/ --- all pages that are /tagged/abc, /tagged/dce etc. will be removed correct? First time trying a directory removal as their are 100 plus of these tagged pages. Comments, suggestions and past experiences welcome!
Technical SEO | | paul-bold0 -
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 -
Is it a bad that my site has the same title and description for directory listings?
I manually listed my site in a few hundred free directories, two paid directores (Joe ant $40, and dirmania $12), and 50 directories that require a reciprocal link ( I paid for a cheap service that gets around having to do the reciprocal). I made the big mistake of having the title and the description for these as the same or very close to the same...is this a huge problem? Should I have my site removed from the free directories or just let it go? I've since stopped focusing on all the directories, and considering saving up to get in Yahoo directory. Working now on getting legit and relevant links from .edu sites.
Technical SEO | | eugenecomputergeeks0 -
TLD as part of word in domain name?
What is best practice regarding domain names? Assuming I would target the keyword "example" examp.le or example.com I guess the latter is preferable, what could be the issues with the first option? /Lars Eriksson
Technical SEO | | LarsEriksson0