Forum Moderators: phranque

Message Too Old, No Replies

Redirect 410 (based on partial string)

I'm getting rid of a lot of files in a dynamic database

         

renomart

6:58 am on Jan 12, 2006 (gmt 0)

10+ Year Member



Hi everyone,

I am using Joomla CMS and I want to get rid of the old Mambo phpshop files as I am going to use VirtueMart instead.

I do not want to redirect the old files to Virtuemart as I wish to start from scratch.

Basically, I would like to delete all references to com_phpshop after /index.php? and everything else after e.g

myrootsite/index.php?option=com_phpshop&Itemid=26&page=shop.browse&category_id=6

There are thousands of files out there. Looking at Awstats tells me that Google is getting a valid 200 header response from my site even though the files are not there any more. So I would like to tell Google "Look, here's a 410 Gone. No more files for you!

Does anyone know how I can do this please?

jdMorgan

12:56 pm on Jan 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The technique shown in this thread [webmasterworld.com] can be used to detect a query string.

You'll need to modify the code to generate a 410-Gone response, but that's a fairly simple thing to do.

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim

renomart

1:32 pm on Jan 12, 2006 (gmt 0)

10+ Year Member



Hi JD. Does this seem right?

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{QUERY_STRING} ^id=1$
RewriteRule ^index.php?option=com_phpshop\.$ [G]

This is what I have now in my.htaccess as well.

---------------------
# mod_rewrite in use
DirectoryIndex index.php

RewriteEngine On

# for apache on windows you might need to uncomment
# this Options line
#Options +SymlinksIfOwnerMatch

# Uncomment following line if your webserver's URL
# is not directly related to physival file paths.
# Update YourMamboDirectory (just / for root)

RewriteBase /
#
# Rules
#

RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^(.*) index.php
--------------------------------------

Is it OK to have RewriteEngine on twice in the .htaccess file?

Thank you.

jdMorgan

2:35 am on Jan 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try this:

RewriteCond %{QUERY_STRING} ^option=com_phpshop
RewriteRule ^index.php$ - [G]

Because the query sring is not anchored, it will match queries of "option=com_phpshop" plus anything (or nothing) else. Then, if the requested page is also "index.php", a 410-Gone response is returned.

See "anchoring" in the regular expressions tutorial cited in our forum charter [webmasterworld.com].

Note that The Options and RewiteEngine on directive need only appear once in each .htaccess file before any other mod_rewrite directives.

Jim

renomart

8:02 am on Jan 13, 2006 (gmt 0)

10+ Year Member



Thank you for your help JD. The redirect worked!

------Thread can be closed------