Forum Moderators: phranque

Message Too Old, No Replies

rewrite to 410 gone

.htaccess

         

Reid

9:57 am on Jun 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok I'm not good at this stuff but I managed to get some 301 redirects in my .htaccess and they've been working great for months, but I've decided to change it to 410.

RewriteRule ^wadget\.html$
ht*p://w*w.example.net/widget.html [R=301,L]

is this right?

RewriteRule ^wadget\.html$ [R=410,L]

Romeo

2:37 pm on Jun 12, 2005 (gmt 0)

10+ Year Member



hi Reid,

these both should work:

redirect 410 /wadget.html

or

rewriterule ^wadget\.html$ - [G,L]

(G =gone, sending a 410)

Regards,
R.

Reid

12:50 am on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thanks Romeo - I would like to use the second one but I don't understand what the dash is.

- [G,L]

jdMorgan

2:21 am on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



 RewriteRule ^wadget\.html$ - [G]

This means, "Rewrite requests for the local URL-path 'wadget.html' to the same URL-path, and return a 410-Gone status."

So essentially, "-" means "Leave the URL-path alone."

[L] used with [G] is redundant, so I left it out.

Jim

Reid

5:16 am on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thanks Jim

Reid

6:45 pm on Jun 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ok I have this other website on a different host that does not allow rewrite engine.
it is a frontpage site running on apache
here is the .htaccess I have permission to edit but this attempt at returning 410 does not work - the rest of the file was written already.
is there a way around this?

# -FrontPage-

IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.example.com
AuthUserFile /home/username/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/username/public_html/_vti_pvt/service.grp

# I added this but it doesn't work
RewriteEngine ON
RewriteRule ^/somepage\.html$ - [G]

Reid

12:30 pm on Jun 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



anyone?

Reid

8:19 am on Jul 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ok more info
this FP site uses Cpanel. It allows me to enter 301 or 302 redircts via a form field it also has a form page for IP deny but it has no automatic way to do 410.

the example above is exactly what I have to deal with and I can manually edit it but here is where I'm stuck. Is there another way I can do a 410 here?

jdMorgan

6:08 pm on Jul 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See this recent thread [webmasterworld.com] for important information about using mod_rewrite with FrontPage Extensions.

Jim

Reid

10:28 pm on Jul 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thanks again Jim - I've read that other thread and understand the problem a bit better.

In my particular case it is on a virtual host. They do have a form page that will add a 301 or 302 automatically. I was wondering if there was something i could do using the method they already accept.
The automatic device will insert this into the .htaccess below the FP extensions.

RedirectMatch permanent ^/wadget.html$
http://example.com/widget.html

If I select a temporary redirect in the form it will use similar code but switch to RedirectMatch temp

they are not even using the rewrite engine it seems.

is there a similar method to invoke a 410?

if there is - what i plan to do is search through the .htacces files and see where this code was inserted automatically (if anywhere other than the root) and use the 410 method (if there is one)

jdMorgan

10:41 pm on Jul 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't use control panels, so I don't care to guess about their features. You are starting to push beyond the usual capabilities of control panels here.

To the best of my knowledge, the forced 410 response is only available using mod_rewrite, and not the Redirect and RedirectMatch directives of mod_alias.

Jim

Reid

4:00 am on Jul 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You are starting to push beyond the usual capabilities of control panels here.

Yes I realize that - just thought if there was another way to force 410 I could use the method most compatable with the way the server is already set up.

It looks like I could use mod_rewrite in this case - as outlined in the thread you pointed out - I was just hoping to find a simpler solution using mod_alias since that is already in place.

Reid

4:27 am on Jul 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



so what i get from the other thread is that in order to force a 410 when using FP extensions this is how.

#in the root (www) folder .htaccess put
RewriteEngine on
Options +FollowSymLinks
RewriteRule ^widget\.html$ - [G]

and also ensure

Options +FollowSymLinks
in the other FP folders mentioned

is that correct?

also would you recommend inserting this code before or after the FP stuff in the root folder or does it matter?

Reid

9:56 pm on Jul 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ok just to follow up I got it working.
I added the code above to the root .htaccess file (above the FP generated stuff)
and did this (taken from the other thread)

posted by choppin2256
Then replace:

"Options None" with "Options +FollowSymLinks" in every single htaccess file that you can find. There will only be about 7 of these files according to the subdirectories I listed below. Here are some subdirectories where they may be found:

_vti_bin (_vti_adm, _vti_aut)
_vti_cnf
_vti_log
_vti_pvt
_vti_txt


Thanx again Jim and choppin2256

jdMorgan

1:59 am on Jul 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Believe it or not, that thread may end up famous. We have had these "FrontPage Extensions versus .htaccess" threads for years, and that's the first time anybody found a solution (that I've been able to find).

Glad you got it working!

Jim

Reid

5:11 am on Jul 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



yeah and in the same month as solving the deepthroat mystery.