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
-
IP Change
Hello MOZ friends! We recently changed servers and subsequently had a change in IP. It's a better and faster server but have seen a significant drop in SERPS. Could this be a result of moving the site? Thanks!
Technical SEO | | wearehappymedia0 -
What directory should a site go in (url structure)?
Hi All, The is the first actual SEO campaign i've worked on and I had a few question about where the site should live on the server and url structure. The site is in WP and we're using Yoast SEO. Anyway the site lives in a a folder called Coastal, which is a child of the WWW folder. So the permalink of the homepage is mcoastalwindows.com/coastal/. The URL is mycoastalwindows.com. The thing is I can still get to the homepage or any of the pages on the site by typing in the /coastal/. Another example is permalink mycoastalwndows.com/coastal/siding/ and url mycoastalwindows.com/siding/. The urls always display without the /coastal/, so I'm not too worried about people linking to them, but Yoast puts a canonical element to the permalink and always includes the /coastal/. Also I'm seeing that Google displays a lot of the urls with the /coastal/, which is an issue seeing as we don't link to the pages that way. My original thought was to solve this at the source and just move everything out of the coastal directory, but the developer swears that it's more secure being in another folder especially with WP. What would you all do and what is best practice? Would you move everything out of the coastal folder, 301 re-direct, do something with. htaccess, or another solution? Appreciate the input thanks!
Technical SEO | | Mario.Souza0 -
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 -
Changing IP adress of Website will impact on ranking or not?
Hello, We have TLDs as below:
Technical SEO | | CommercePundit
bannerbuzz.combannerbuzz.co.uk
bannerbuzz.com.au
bannerbuzz.ca Within few days, We are moving in Magento Technology for 2 domains,
Bannerbuzz.com.au and Bannerbuzz.co.uk We have purchased new plan, So IP address of those 2 domains will be changed. So my question is, It will impact on my current Ranking or not?0 -
Too many links? Do links to named anchors count (ie page#nameanchor)?
Hi, I have an internal search results page that contains approx 200 links in total. This links to approx 50 pages. Each result listing contains a link to the page in the format /page.html and also has 3 more links (for each listing) to named anchors within the page. eg /page.html#section1, /page.html#section2, /page.html#section3 etc. Should i remove the named anchors to keep my links per page under the Seomoz suggested max of 100? Will it impact crawl-ability or link juice being passed? Thanks in advance for your response.
Technical SEO | | blackrails0 -
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 -
Keyword stuffing found, how does Google treat my business name that contains keyword?
Hi, SEOmoz found 72 occurances of my keyword 'widgets' on our front page. I'm trying to cut it down but alot of the time the keyword appears alongside the company name 'Mega Widgets' . Will Google distinguish between the use of the keyword within a typical sentence and having it alongside the company name? Or should I put in a hypen (mega-widgets) or surround the company name with quotes ("mega widgets") to tell Google its a legit combination/phrase and I'm not trying to stuff in the keyword?
Technical SEO | | SpecialCase0 -
Hyphenated Domain Names - "Spammy" or Not?
Some say hyphenated domain names are "spammy". I have also noticed that Moz's On Page Keyword Tool does NOT recognize keywords in a non-hyphenated domain name. So one would assume neither do the bots. I noticed obviously misleading words like car in carnival or spa in space or spatula, etc embedded in domain names and pondered the effect. I took it a step further with non-hyphenated domain names. I experimented by selecting totally random three or four letter blocks - Example: randomfactgenerator.net - rand omf act gene rator Each one of those clips returns copious results AND the On-Page Report Card does not credit the domain name as containing "random facts" as keywords**,** whereas www.business-sales-sarasota.com does get credit for "business sales sarasota" in the URL. This seems an obvious situation - unhyphenated domains can scramble the keywords and confuse the bots, as they search all possible combinations. YES - I know the content should carry it but - I do not believe domain names are irrelevant, as many say. I don't believe that hyphenated domain names are not more efficient than non hyphenated ones - as long as you don't overdo it. I have also seen where a weak site in an easy market will quickly top the list because the hyphenated domain name matches the search term - I have done it (in my pre Seo Moz days) with ft-myers-auto-air.com. I built the site in a couple of days and in a couple weeks it was on page one. Any thoughts on this?
Technical SEO | | dcmike0