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
-
Google still listing pages from old domain after 2 change requests
Good Morning I put forward the following question in December 2014 https://moz.com/community/q/google-still-listing-old-domain as pages from our old domain www.fhr-net.co.uk were still indexed in Google. We have submitted two change request in WMT, the most recent was over 6 months ago yet the old pages are still being indexed and we can't see why that would be Any advice would be appreciated
Technical SEO | | Ham19790 -
Changing menus regularly - will this impact SEO
We are working on an internal project, where the website owner is thinking of making regular changes to one or two items on the top level menu. Assuming they redirect the original pages or navigate to them in other ways, is there any other impact on SEO to changing the menu structure? I assume they'd submit new sitemaps after each change. Many thanks Fiona
Technical SEO | | fionah0 -
With rich snippets is it bad to add a city to the company name?
I have a client that is a franchise. Each franchise location has a different office address. Is it bad for me to do the following? COMPANY NAME of CITY ... .... There are about 10 franchisees. Should I use just the company name? Is the city in there going to be a negative?
Technical SEO | | thomas.wittine0 -
My .htaccess has changed, what do i do to avoid it again...?
Hello Today i notice that our site did not auto changed from without www to with, when i checked the .htaccess file i notice # in-front of each line and i know we did not insert it in there, after i removed it it worked fine. The only changes that we did recently was to a mobile version to the site but the call to autodirect is in a JS and not in the .htaccess, could it be the server..? is there any way that anything else might cause this...? The site is HTML and WP could it be because of that...? Thank's Simo
Technical SEO | | Yonnir0 -
I grabbed a better domain name. What next?
I have been trying to rank well for the key word "National Currency" forever and can't seem to make it into the top ten. I would really like to have the URL NationalCurrency but it's taken and can't be bought. My url is nationalcurrencyvalues. After reading the forums and various other SEO advice it occurred to me that National-Currency is as good or better than NationalCurrency for that keyword because it's seen as two words. (right) So, I grabbed that domain name. Now, my question... is there some way to make use of the National-Currency domain name without building an entirely new site? I don't think I want transfer all of my content from nationalcurrencyvalues. Would there be any benefit to my nationalcurrencyvalues if I set up 303's on National-Currency?
Technical SEO | | Banknotes0 -
Can I do a redirect to a new domain name only a couple of weeks after having redirected to another domain?
I have a client with two website with very similar content. Both had a lot of inbound links and performed fairly well in SERPS. We recently combined both sites and have redirected one of the domains to the other. The traffic dipped slightly initially, but is recovering nicely. Now the client registered a new domain name he would like to use for the site. Should I wait a few weeks for everything to settle down after the first redirect/consolidation of sites before doing a new redirect to a new domain name, or should I not worry about having any issues with doing it right away?
Technical SEO | | Drewco0 -
Directory Categories
Is it important to select the right category for directory listings from an SEO point of view? I have located 2 appropriate categories in Business.com for my website: Category 1 = PR 5, Page Authority 53 Category 2 = PR 4, Page Authority 44 I presume number of links on the page is also a factor.
Technical SEO | | martyc0 -
How to proceed with domain switch AND url change
Hi, in a few weeks we'll do a major change on our website. This involves over 1.5 million pages indexed in Google driving substantial amount of our traffic. Basically we have 2 types of changes: subdomain switches to domain:
Technical SEO | | TruvoDirectories
ex. product.company.com will become www.product.com
for this we know how to manage DNS and Apache rules different url patterns, basically replacing ugly urls by pretty urls
for this we have advanced 301-mapping rules set up Here is the question - what is best way to proceed with these 2 changes in order to preserve rankings and organic traffic: Do both changes simultaneously? First do url changes, than the domain switch Can you please share your thoughts?0