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
-
Huge drop in rankins, traffic and impressions after changing to CloudFlare
Hi there, In October, one of our customer's programmer made a change on their website to optimize its loading speed. Since then, the all the SEO's metrics has dropped. Apparently, the change was to move to CloudFlare and to add Gzip compression. I was talking with the programmer and he told me he had no idea why that happened. Now comes 5 months later and the SEO metrics havn't come back yet. What seems so wierd is that two keywords in particular had the most massive drop. Those two keywords were the top keywords (more than 1k of impressions a month) and now its like there is no impressions or clics at all. Did anyone had the same event occur to them? Do you have any idea what could help this case?
Technical SEO | | H.M.N.0 -
What changes to subdomains - geo targeting - redirects - to boost our global ranking?
Hi, This is a complex question and I will really appreciate your help as this decision is essential to our business! We are taking a decision about what to do with our website in the terms of redirecting visitors based on their location. At the moment we have the following structure of the website: .com version practically only hosts our blog. The US traffic get presented with .com/us version automatically and the rest of the world gets presented with .com/uk. We are thinking to make .com version global (so no more .com/uk for all countries) in order to improve our ranking globally. At the moment we have good ranks in the UK, but not in the US and other countries. Our company is a global company now and we would like to get more exposure in other countries. We are also thinking to allow the option of geo redirects possible via a small pop-up window - visitors will be able to select their preferred country so next time they will be presented with their default option. To make it short: we would like to boost our domain without dropping ranks in the UK which we are now achieving through .com/uk version. Any ideas, recommendations or experience, I will appreciate! Thanks! Kat
Technical SEO | | Katarina-Borovska0 -
How to change primary language of the website?
Problem: there is a domain.com which primary language is Lithuanian, we want to switch it to English. The English content is on the website fully translated under domain.com/en/english-url. Question: How do i switch English content to domain.com while moving the Lithuanian one to domain.com/lt/lithuanian-url The purpose of course is NOT to loose neither English nor Lithuanian organic traffic Possible solution: the only solution I though of is to 301 English /en urls to domain.com ant to 301 the Lithuanian domain.com urls to /lt. Is that everything I should do or is there some other meta tags, server side or other stuff i should be worried about?
Technical SEO | | SEO_MediaInno0 -
I am able to point an old domain name to part of my site
hi, i have a domain name to a site that i have but i am thinking of closing that site down and transfer it to a site that is popular. I want to know if i am allowed to point the domain name to a section of my site and if so would it benefit my site or should i just continue running the other site and make it better. would the links to that site be transfered to my site any advice would be great.
Technical SEO | | ClaireH-1848860 -
No index directory pages?
All, I have a site built on WordPress with directory software (edirectory) on the backend that houses a directory of members. The Wordpress portion of the site is full of content and drives traffic through to the directory. Like most directories, the results pages are thin on content and mainly contain links to member profiles. Is it best to simply no index the search results for the directory portion of the site?
Technical SEO | | JSOC0 -
What is the best way to deal with pages whose content changes?
My site features businesses that offers activities for kids. Each business has its own page on my site. Business pages contains a listing of different activities that organization is putting on (such as events, summer camps, drop-in activities). Some businesses only offer seasonal activities (for example, during Christmas break and summer camps). The rest of the year, the business has no activities -- the page is empty. This is creating 2 problems. It's poor user experience (which I can fix no problem) but it also is thin content and sometimes treated as duplicate content. What's the best way to deal with pages whose content can be quite extensive at certain points of the year and shallow or empty at other parts? Should I include a meta ROBOTS tag to not index when there is no content, and change the tag to index when there is content? Should I just ignore this problem? Should I remove the page completely and do a redirect? Would love to know people's thoughts.
Technical SEO | | ChatterBlock0 -
Changing CMS, are there SEO effects?
We want to change our cms from typo3 to CMS made Simple. We have done this already for another site and it effected the rankings. Have you got experience with this? What factors are important for SEO to consider? Is it normal when you change from cms the rankings will drop?
Technical SEO | | PlusPort0 -
Domain extension is a ranking factor? Does it change de value of my SEO
Im trying to find a good domain for my business, but a domain for my country ".com.br" with exact keyword is not available any more. I want to know if i buy a domain name with other extension like www.mykeyword.info or .biz is take bad effect in my SEO. Or it doesn't matter? If so, wich extension domain is good for SEO? Thanks!
Technical SEO | | Ex20