Welcome to WebmasterWorld Guest from 50.16.24.12

Forum Moderators: Ocean10000 & incrediBILL & phranque

410 - gone in htaccess

410 a page with spaces in URL

   
5:46 pm on Jan 6, 2007 (gmt 0)

5+ Year Member



I want to 410 a page in my htaccess that has spaces in the URL. I replaced the spaces with %20, but it always returns a 404.
Other 410's (no spaces in the URL) work fine.
What could be the problem?
9:29 pm on Jan 6, 2007 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Please post an example of the code that doesn't work, with "example.com" as the domain.

Thanks,
Jim

10:06 pm on Jan 6, 2007 (gmt 0)

5+ Year Member



Hi Jim, here is the main part of the htacess plus the redirect that won't work. Thanks for your help!

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.(.*)
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
#
RewriteEngine on
RewriteRule ^Folder%20with%20three%20spaces/page.htm$ - [G]

I tried it with the %20 and with spaces, also with a "\" at the end of the URL, but with no success.

10:34 pm on Jan 6, 2007 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



You don't need more than one RewriteEngine on directive in the file -- at the top.

I can't remember which of these will do it, but one of them will:


RewriteRule ^Folder\ with\ three\ spaces/page\.htm$ - [G]
#
RewriteCond %{REQUEST_URI} ^Folder\ with\ three\ spaces/page\.htm$
RewriteRule ^Folder - [G]
#
RewriteCond %{REQUEST_URI} ^Folder\%20with\%20three\%20spaces/page\.htm$
RewriteRule ^Folder - [G]
#
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /Folder\%20with\%20three\%20spaces/page\.htm\ HTTP/
RewriteRule ^Folder - [G]

Also, put the simplest one of these that works above your domain redirect rule -- There's no use redirecting the domain and then returning a 410 for this file.

The URL-paths seen by RewriteRule, by RewriteCond in %{REQUEST_URI}, and by RewriteCond in %{THE_REQUEST} undergo various degrees of un-encoding, from most to least, respectively.

Jim

11:52 am on Jan 7, 2007 (gmt 0)

5+ Year Member



Thanks Jim, the first version is working (so I didn't try the others).
And thanks for the other tips, too!
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved