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
-
Company name ranking
Hi all, I hope somebody can share their thoughts on the below. A web designer launched my client's new website and I have been tasked with the SEO. I was approached with an immediate problem, www.clientswebsite.co.uk was ranking 9th for their company name after being indexed by Google. The search results above www.clientswebsite.co.uk were related to my client but not all, for example a direct competitor was also ranking. I have been working on the SEO for 2-3 weeks and I just managed to get to 3rd position for the company name, and then www.clientswebsite.co.uk disappeared from page 1! And now instead, an irelevant sub page is now ranking for the company name on page 2 (a contact page). I have checked and the home page is still indexed (did a site: check). The only problem software picks up is a redirect chain (http://homepage -> http://www.homepage -> https://homepage) the web developers said it wouldn't impact rankings (when I asked them to edit the htaccess file to fix it) I've listed below the SEO tasks I completed whilst attempting to rank the company name: I set up analytics and webmaster tools, in which I set up preferred domain (www) Added a sitemap Edited meta data making sure company name was included I contacted the websites above www.clientswebsite.co.uk that were relevant and asked them to place a link linking to their new website, I was successful with a couple of these. I placed www.clientswebsite.co.uk on all of their social media profiles I reformatted headers on their home page, making sure the H1 included my client's company name I found 2 extra versions of my client's home page (not exact copies, but very similar content) that had been published, so I decided to 301 redirect these to the correct home page Activated SSL and forced to HTTPS I would really appreciate it if anyone could share their thoughts here, whether it be explanations or possible solutions Adam
Technical SEO | | SO_UK0 -
Changing URL of posts
HI, I need to change the urls and permalink structure of my blogposts. How I have to deal all this with google? Do I have to re-submit the pages to google with fetch as google? Will google display duplicate content of the same article ( having changed the url) or will it automatically replace the old url with the new ones? Tx for your support guys!
Technical SEO | | tourtravel0 -
Does google know every time you change content on your page
What i mean by the question is, so on our home page www.in2town.co.uk we change the article under lifestyle story of the day, if this changes every hour, will this encourage google to visit that page more often or will then just ignore that and just visit each day would love to hear your thoughts on this
Technical SEO | | ClaireH-1848860 -
Changing title tag in wordpress media pages
Hello! I have a problem of duplicate title on 59 pages in Worpress. I Guess it happened after a recent WP update, because, suddenly, I got a peak of 59 from zero in a day. The SeoMoz crawl report states that there are 59 duplicate title. As you may see in the picture those are all media pages, whose title is written really badly with the formula postname/filename/blogTitle, ending up with trunkated, too long, title tags, that result in duplicate page title. How can I simply hide these mediapages or sculpting the title tag the way I want? I am using all-in-one-seo WP plugin, which doesn't seem to provide a solution. Thank you all! DoMiSol Rossini SOwZg5C.jpg
Technical SEO | | DoMiSoL0 -
If I switch my domain name, will I keep link juice from redirect?
I am moving one of my sites wellington-florida-homes.com to a new domain (wellingtonfloridahomes.com). Most of our link-juice is coming from another domain we purchased (theshockleyteam.com) that is redirected to our primary site. If I simply redirect theshockleyteam.com to our new domain (wellingtonfloridahomes.com) I will still have the link juice passing through, right? Thanks!
Technical SEO | | RickyShockley0 -
Selecting a new domain name
If a two word domain is already taken (e.g. onetwo.com), which of the following is a better alternative? 1. one-two.com 2. onetwo.org Best,
Technical SEO | | ChristopherGlaeser
Christopher0 -
Used SEOMOZ top 100 Directories, my site ranking lowered, what can we do to fix this?
We have made a big mistake.... So what can we do to fix this? A trainee member of staff has used the seomoz 100 top directories and added to sites from PR10 to PR6 approx about 25 sites, using keywords were possible instead of using the website URL "which i now was stupid!. Our website ranking have been lowered big time for all keywords used!, eg from 1st to 10th and even disappeared from the top 100 We are contacting all directories asking for the Title link to be changed to the URL instead of a keyword.. Will this help? I understand that Google give sites a penalty for this!!, but what can i do to put this right and how long would this penalty last for? Any advice would be highly appreciated... Thanks Dean
Technical SEO | | deanpallatt0 -
Keywords in file names vs folder names
We understand the value of a keyword phrase included in the URL. Is there more value to having that phrase in the folder name of the URL or the file name or does it matter? Example: http://www.biztoolsone.com/website-design.php or http://www.biztoolsone.com/website-design/ Which is best? Thanks, Wick Smith
Technical SEO | | wcksmith0