Remove a directory using htaccess
-
Hi,
Can someone tell me if there's a way using htaccess to say that everything in a particular directory, let's call it "A", is gone (http 410 code)? i.e. all the links should be de-indexed?
Right now, I'm using the robots file to deny access. I'm not sure if it's the right thing to do since Google webmaster tools is showing me the link as indexed still and a 403 error code.
Thanks.
-
<colgroup><col width="205"> <col span="14" width="64"></colgroup>
| Hello webtarget, First of all I want to tell you about the .htaccess file, It is the file which control the Apache webserver, is very useful and allows you to do a lot of things. |
| Here the below is the link which solves your whole problem regarding .htaccess file. Please check & review it. | | | | | | |
| http://www.catswhocode.com/blog/10-awesome-htaccess-hacks-for-wordpress | | | | | | | | | | -
That's great thanks.
-
Hi
This should solve your problem
<code>RewriteEngine on
RewriteCond %{REQUEST_URI} ./folder/.
RewriteRule (.*) http://www.yourdomain.com/gone.php [R=410,L]</code>Replace "folder" with the name of your folder and instead of a
<code>http://www.yourdomain.com/gone.php</code>
put link towards the page informing visitors that request resource is gone.
Kind regards
Bojan
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
-
What do you use to come up with content ideas?
Buzzsumo charge and not sure it's worth it. didn't find Quora helpful. Any others?
Technical SEO | | SwanseaMedicine2 -
Is this a correct use of 302 redirects?
Hi all, here is the situation. A website I'm working on has a small percentage of almost empty pages. Those pages are filled "dynamically" and could have new content in the future, so, instead of 404ing them, we automatically noindex them when they're empty and remove the noindex once they have content again. The problem is that, due to technical issues we can't solve at the moment, some internal links (and URLs listed in sitemaps) to almost empty pages remain live also when pages are noindexed. In order not to waste Google crawler's time, sending it to noindexed pages through those links, someone suggested us to redirect those pages to our homepage with a 302 (not a 301 since they could become indexable again, so it can't be a permanent redirect). We did that, but after some weeks Search Console reported an increase in soft 404s: we checked it and it is 100% related to the 302 implementation. The questions are: is this a correct use of 302 redirects? Is there a better solution we haven't thought about? Maybe is it better to remove 302s and go back to the past situation, since linking to noindexed pages isn't such a big problem? Thank you so much!
Technical SEO | | GabrieleToninelli0 -
Does anyone use Ning (Custom social site)?
We just got a custom Ning site developed and the second we moved it to our domain, we lost almost all of our rankings in Google. So, we sign up for a SEOMoz Pro account and within a week we see that we have over 6,000 errors and warnings on our site. Duplicate content, duplicate page titles and pages with too many links. Is anyone using Ning and successfully maintaining 1st page rankings in Google? Seems to me that we need hundreds of fixes and modifications in the code of our site to fix all of these errors and get Google to take our penalizations off.
Technical SEO | | danlok0 -
Hiding sub directory from a url string
I have been trying for a few hours now to hide a sub-directory from a url string on a joomla site using .htaccess every method i have found either has no effect or breaks the site. i am aiming to change all links with component in them: http://mysite.com/component/music/7335 to http://mysite.com/music/7335 I am using the latest Joomla 2.5 install but not sure how or if that affects anything. Any help would be greatly appreciated
Technical SEO | | omega0 -
Redirect non-www if using canonical url?
I have setup my website to use canonical urls on each page to point to the page i wish Google to refer to. At the moment, my non-www domain name is not redirected to www domain. Is this required if i have setup the canonical urls? This is the tag i have on my index.php page rel="canonical" href="http://www.mydomain.com.au" /> If i browse to http://mydomain.com.au should the link juice pass to http://www.armourbackups.com.au? Will this solve duplicate content problems? Thanks
Technical SEO | | blakadz0 -
Limits to 301 in htaccess?
I'm about to launch a redesign of my company's main website, and we've updated most of the URLs to be more user friendly and SEO optimized. I've just finished editing my spreadsheet, and see that I'll need to implement 244 redirects. My question is: Are there performance issues with loading your .htaccess file up with almost 250 301 redirect commands? I've heard a bloated htaccess file can really slow down apache, should I be approaching this a different way, maybe with php?
Technical SEO | | AdoptionHelp0 -
Linkedin how to use it to promote your business
Hi i have been told about linkedin and how good it is but every time i look at it, it puzzles me and i am not sure if it is worth joining or not. I am looking to promote in the UK and not abroad and would like to know how good it is. Even my accountant uses it but each time i look at it i cannot get my head around it and how to use it to promote my business. Can anyone please let me know how much it cost to join and if it will have any benefits for me to promote my business and my sites. I look forward to hearing from you
Technical SEO | | ClaireH-1848860 -
Does google use the wayback machine to determine the age of a site?
I have a site that I had removed from the wayback machine because I didn't want old versions to show. However I noticed that in many seo tools the site now always shows a domain age of zero instead of 6 years ago when I registered it. My question is what do the actual search engines use to determine age when they factor it into the ranking algorithm? By having it removed from the wayback machine, does that make the search engines think the site is brand new? Thanks
Technical SEO | | FastLearner0