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
-
My brand name has 2 words but Google only indexing as 1 word. Is there a fix?
Hi all...I'm at a loss. I've never had this happen. Google only shows pages of my site when I search the brand name as one word. When I Google the site as one word BrandBrand- it only shows my blog page and about us page plus Twitter and Facebook on page 1. The homepage does not show up at all. When I Google the site as two words Brand Brand - My Facebook page is on page 1 but nothing else. The homepage isn't showing up at all. When I search both words on Bing and Yahoo both are indexing it as two words and shows on page 1. Any ideas?
Technical SEO | | TexasBlogger0 -
Changing site URL structure
Hey everybody, I'm looking for a bit of advice. A few weeks ago Google sent me an email saying all pages with any text input on them need to switch to https for those pages. This is no problem, I was slowly switching the site to https anyway using a 301 redirect. However, my site also has a language subfolder in the url, mysite.com/en/ mysite.com/ru/ etc. Due to poor work on my part the translations of the site haven't been updated in a long time and lots of the pages are in english even on the russian version etc. So I'm thinking of just removing this url structure and just having mysite.com My plan is to 301 all requests to https and remove the language subfolder in the url at the same time. So far the https switching hasn't changed my rankings. Am I more at risk of losing my rankings by doing this? Thanks!
Technical SEO | | Ruhol0 -
Changes to title and description not appearing in Google search...
www.heatwavemedia.com Search terms: san francisco video production, san francisco video production services In Google search site appears as "Heartwave Media: San Francisco Video Production Services" but I'm sure I've never used a colon in all my iterations of the title... Instead it reads "San Francisco Video Production Services | Heartwave Media" with the description "A San Francisco video production company specializing in creative corporate and commercial video services." But that's not coming up either... I'm on Wordpress and am using All in One SEO if that helps... Thoughts?
Technical SEO | | keeot0 -
Should I use my competitor's name in my content to help my rankings?
If I have a competitor that ranks higher than me, would it be helpful to use their name in my content, or in my meta information?
Technical SEO | | greaterstudio0 -
Internationalised Domain Names (IDN’s) and SEO
Hi, recently Internationalised Domain Names (IDN’s) are supported. Can anyone give me any indication if there is any SEO benefit in registrering that type of domain names? With Internationalised Domain Names I mean domain names containing "strange characters" like à, é, è, ô, ... . Typical characters used in French, German, Swedish, ... It is now possible to register domainnames (ex. www.hörmann.be). And I was wondering if anyone sees any SEO substance in having this type of domain names.
Technical SEO | | TruvoDirectories0 -
My company is changing ecommerce platforms. What are image URL considerations?
My company is switching from osCommerce to Magento. What should I do about my image URL's? Should I try to recreate the filenames and directory paths from the old site on the new one? How bad is it for our SEO if I can't do that?
Technical SEO | | Kyle_M0 -
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 -
Almost Duplicate Product names (READ almost!)
Hi Mozzers, Here is a dilemma I thought I'd put forward and see how you guys would handle the situations. I'm working on a comparison website on which many of of the product names are very similar. There are circa 2000 products, of which many have similar names. Here are a few of the product names for example; Airsprung Enigma 5ft Mattress Airsprung Double Echo 6ft Mattress Silentnight Double Nova 6ft Mattress The Product name has been used in the page title of the product pages as show below; Compare Prices on the Airsprung Double Echo 6ft Mattress SEOmoz is highlighting these pages as having Duplicate Page Titles (and meta descriptions as a similar approach has been used). How would you handle this situation? Cheers Aran
Technical SEO | | Entrusteddev0