I had a folder called blog on my site. I deleted it all permanently. I would like to 410 it. How do i 410 an entire folder?
e.g. my site looked like this
example.com/blog/mycoolpost1/
example.com/blog/mycoolpost2/
example.com/blog/mycoolpost3/
example.com/blog/mycoolpost4/
now posts 1,2,3,4, are dead.
so how do i specify that everything after blog, is permanently deleted. (as well as the folder 'blog' itself)
I need a htaccess line something like this...?
redirect 410 /blog/?(.*)
The Redirect
directive is the proper way to do this. You should put the following in your virtual host configuration:
Redirect 410 /blog
If you don't have access to the virtual host configuration, you can put it in the .htaccess
file in your document root, or I believe you can put the following in the .htaccess
file in the blog
subdirectory:
Redirect 410 /
(I might be off about that, I'm not sure how exactly Redirect
interacts with path resolution in .htaccess
files)
I don't think Redirect
is the right tool for this, as it only matches the path specified. Just use:
RewriteEngine On
RewriteBase /
RewriteRule ^blog/ - [G]
The following .htaccess would be useful when, for example, you move from a hosting to another and you reorder or delete parts of your web.
As Apache allows human syntax codes I have used permanent instead of 301 code, and gone instead of 410. You can check http protocol codes here Status Code Definitions
I placed the file on my root mynewblogaddress.com folder:
.htaccess
Redirect permanent /wordpress http://www.mynewblogaddress.com/blog/
Redirect gone /gallery2
Redirect permanent /directory2 http://directory2.mynewblogaddress.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With