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
-
Root domain change - how do we best handle existing backlinks from our own content platforms on youtube, etc?
Hi, we have recently changed our brand name after 7 years and have changed our root domain to match (33shake.com since 2012, now 33 fuel.com) The site is the same (no migration to a new one) as there were no other business changes apart from the name/domain. 301 redirects are looking after all former 33shake.com links, which are now being redirected to their new 33fuel.com equivalents (slugs are the same in 99% of cases). My question is: We have a lot of backlinks for our old domain (33shake.com) on our own content via our YouTube channel (100+ videos) and also our podcast (64 episodes in, broadcast on 10 platforms). For maximum SEO benefit as we continue to restore domain authority, etc to 33fuel.com, are we best to leave these historical backlinks pointed at the old domain and let the redirects pick them up when people click? Or are we better off swapping all of these old historical backlinks so they point directly to the new domain? Any advice would be greatly appreciated, this is quite a maze we are now picking our way through! Warren
Technical SEO | | WP331 -
Google Listing Brand Name as Page Title rather than actual set Title
Any search result including our website is displaying our search result title like this: "Brand Name: Partial Page Title" instead of what it should be "Page Title" (as an example). Where is the "Brand Name:" coming from? We've verified we don't have any code that could cause this, and we're blocking in robots.txt directory listings being used for our search result title/meta. This isn't happening for our competitors. Any ideas on why this is, and if it's something we can control?
Technical SEO | | Closetstogo0 -
Doubt between sub-directory and sub-domain for develop Blog for my business website
Hi, I am much aware with SEO. But still there is a confusion in my mind. I am in the process of making blog for my Business website. I am confused between whether my blog should be with sub-directory(www.metaoption.com/ blog) or with sub-domain(blog. metaoption.com). There are many articles on this topic but they have created much confusions. Please suggest me the best option and also give me reason behind it if you can. Thanks
Technical SEO | | Perfect0070 -
Canonical & rel=prev / next changes to website a good idea or not?
Hi all, I decided yesterday to make a load of changes to my website, and today i woke thinking, should i have done that! So below is an example of what i have done (i will try to explain clearly anyway), can you let me know if you think what i have done would harm or help my website in search results etc... ok, so lets take just one category - Cameras And it has the sub categories - box dome bullet it also has other sub categories (which are actually features, but the only way i can show them on my site is by having them as a sub-category with its own static page, and adding the products to these as secondary categories) vandal proof high resolution night vision previously i have it set up so that every single category / sub category / feature had its own static page, with a canonical tag to itself (i.e cameras.html canonical was to cameras.html, vandalproof.html canonical was to vandalproof.html). Any of the categories / sub cats / features that had more than one page were simply not in search results due to the canonical pointing to "Page 1"... What i have now done: Last night i decided to change all this, now for all categories / sub cats / features i have add rel=prev / next where applicable, and removed the canonical from second / third / fourth pages etc, but left the canonical on "page 1". I also removed any keywords from page 2,3,4 etc and changed descriptions to just page "X" + category name. So for example, page one looks like: and page two looks like: I also went a little further (maybe too far) and decided that the features pages would canonicalize back to cameras so for those i now have: Page 1: Page 2: Any advice is welcome on the above, in regards to which way may be better and why, and obviously if anything jumps out as a mistake... Please advise James
Technical SEO | | isntworkdull0 -
Have a client whose name is Scott Gable and his profession is photography
When I do a search for Scott Gable (just his name) google comes up like this (without the sitelinks): http://chrle.us/MGer When I add photography to the search query it comes up like this (with the sitelinks structured below) http://chrle.us/MHXy is his name that common that the full sitelinks wouldn't appear below it on the scott gable search? Would 301 redirecting scottgablephotography.com to scottgable.com help fix this?
Technical SEO | | callmeed0 -
Changing the URL structure will it help me or hurt me?
I got handed a website running on Joomla without the SEO friendly URL check box selected so our URLs all look like this www.rotaryvalve.com/index.php?option=com_content&view=article&id=22&Itemid=37 . I am hoping to rework this website in the near future here and plan on changing the URL structure across the website so there are some actual keywords in the URL. When I did this I was thinking of just doing 301 redirects to the new pages and hopefully the hit from the search engines wouldn't be too bad. Can anyone speak from experience as to what the best way to go about doing this would be so I don't end up falling back ranking wise. Would change the URLs end up helping me or hurting me? Thanks
Technical SEO | | wmwmeyer0 -
I changed the domain and structure of my site,is there anything I can do to help speed the recovery in SERPs?
I change the domain of my site in March (pretty much exactly when Panda hit, by coincidence). Our search traffic has dropped by 90% in that time with little recovery. In webmaster tools it shows about 400,000 pages on the new domain and about 85,000 still indexed on the old domain. I set up custom 301 redirects to all of the new pages on the new domain so everything that was moved has a good one hop redirect. I've been told that the only thing I can do is sit back and wait for everything to finish transitioning. The problem is that it has been 5 months of poor traffic, which means 5 months of slow sales. Is there anything I can do the speed up the transition?
Technical SEO | | iJeep0 -
Does IP Changes Affect SEO Metrics?
Okay, So yesterday I asked a question about setting up custom error pages in IIS 6.0 to properly do a 24 hour 503 Service Temporarily Unavailable. With no answer, (not to the despair of the community as the question has NO simple or easy answer 🙂 So after a night of dreaming about solutions 🙂 I realized that we have the ability to just clone the site.... So basically it would just become a redundant server or mirror site for 24 hours. With all that being said the question is..... What SEO pitfalls might I encounter from this if any I suspect none as load balancing and redundancy is a fact of life in the WEB world, especially since it will be a MAX of 24 hours downtime for maint.
Technical SEO | | Jinx146780