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
-
Magento URL change
We have a Magento website parked at HostGator. The site is comprised of both a PC and a mobile version. We changed the URL to a new one ... We made the domain changes in the ‘core_config_data’ (phpMyAdmin) ... We flushed the cache in the ‘File Manager’ part of cPanel (regular and mobile version) Currently we can access the http://newsite.com (on a desktop) with no problem ... We can also access http://m.newsite.com BUT… only from a desktop PC. When we try http://newsite.com from a MOBILE device, it routes to: http://m.OLDsite.com (it keeps going to the old URL) Need some help please. Thanks in advance!
Technical SEO | | Prime850 -
Two Dentists, Same Address, Same Phone, Different Business Names
Hi Everyone, I've been looking into this situation for quite a while, but most posts/information on this topic seem to be from at least 1-2 years ago. I'm currently working with a dentist who just moved into the same suite as another dentist who has been working there for years. They each have the same address and same suite number, the same phone number, but each own their own respective practice and have their own patients. To make things even more complicated, the dentist that has been working there for years uses his name as a business name, while the new dentist has a business name differing from her actual name. I'm not exactly sure how to go about optimizing the new dentist's local presence, but the only thing I can think of doing is try to recommend having the suite split into Suite #-A and Suite #-B and seeing if it's possible to add a second phone number for the new dentist. Please let me know your thoughts, and if you've seen this topic come up in the past, I would love to get pointed in the right direction. Thanks for all your help!
Technical SEO | | abnovak1 -
Changing .nl to .eu impact on rankings?
Hi all, I have 2 questions concerning the merge of two websites of ours.
Technical SEO | | MarikeP
We would like to combine our .nl and .be website to one big .eu website. Both websites have dutch and english rankings in The Netherlands and Belgium. 1. Will the rankings change because of the domain change to .eu?
2. Will the rankings in both countries change because of the merge? I hope somebody can help me, Greetings0 -
How a change in IP address affects SEO?
Our domain is pretty mature, has several quality backlinks - ranks well for our key terms - but we need to change our IP address because we use a cloud provider and it's a shared IP that has had a security breach. How will this affect rankings? www.layer7.com
Technical SEO | | Layer7Tech0 -
Can name="author" register as a link?
Hi all, We're seeing a very strange result in Google Webmaster tools. In "Links to your site", there is a site which we had nothing to do with (i.e. we didn't design or build it) showing over 1600 links to our site! I've checked the site several times now, and the only reference to us is in the rel="author" tag. Clearly the agency that did their design / SEO have nicked our meta, forgetting to delete or change the author tag!! There are literally no other references to us on this site, there hasn't every been (to our knowledge, at least) and so I'm very puzzled as to why Google thinks there are 1600+ links pointing to us. The only thing I can think of is that Google will recognise name="author" content as a link... seems strange, though. Plus the content="" only contains our company name, not our URL. Can anybody shed any light on this for me? Thanks guys!
Technical SEO | | RiceMedia0 -
Name Servers & SEO
We have decided to create a few blogs and will eventually be linking to some of our clients. I have domain privacy and different class C addresses for each of my domains. But the name servers area all the same. Ex: If we create an article for one client on all 5 blogs, will the name servers be a problem?
Technical SEO | | waqid0 -
Help changing category and page titles on established Magento site.
Hi All, This is my first post, I've been a Pro member for a while now, read many posts but have never asked a question here. I have an established Magento site that I need to do a lot of SEO work on. I am a newbie at SEO, so I wanted to ask for advice here. I just changed one of the category names, the url, meta title, and meta description. When making the change I selected the checkbox in the Magento backend that says "Create Permanent Redirect for Old URL" Example:
Technical SEO | | TrulyLuna
Old Category: http://www.domain.com/old-category-name.html
New Category: http://www.domain.com/new-category-name.html Everything worked fine with the exception of one alarming thing... I lost all of the page authority for the category itself and all of the sub categories and pages below it. Now the category and all pages below it show (on the moz toolbar) a PA of 1 and 0 links and 0 domains. I updated the sitemap. I did not do a 301 redirect in the .htaccess, I only chose the option to redirect on the Magento backend when changing the name and url of the category. I need to change a lot of other category and page names and urls but now I'm a bit gun shy, as I do not want to do something that will damage what little page rank I have at the moment. I'm looking for some advice from one of you guys who might be able to help me do this the correct way. I did some research on Google, but I'm still not sure of the correct method to accomplish this. Thanks in advance for any help that you can offer.0 -
Changing TLD type
Hi, Our client required us to change the TLD of is domain. Currently it is something like www.xyz.qc.ca and they have registered www.xyz.ca which while be more easier to remember. What would be the best pratice for migrating the domain? Use webmaster tool domain change? Making the new domain name the defaut one and use 301 redirections? Or both ? Thank you M.Adey
Technical SEO | | madey0