Welcome to WebmasterWorld Guest from 174.129.135.89

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Rule to write

   
8:04 am on May 5, 2014 (gmt 0)

5+ Year Member



Due to a bug doing an upgrade from joomla 1.5 to 2.5 google indexed pages with numbers in it that I don't want indexed.

Could someone tell me which rule to write in the htaccess to return a 410 or 404 for all the web address with a number in it ( I want a range, I don't want to do specific numbers ).

Thank you,
8:37 am on May 5, 2014 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Oh, come on. You know we don't write your code for you. ;) What have you tried so far?

It may or may not be necessary to know what these newly indexed URLs represent. Are they duplicate URLs for pages that already exist under some other name? Or pages that were there all along but weren't supposed to be indexed? What do you want to happen to humans who blunder across these URLs?

It is possible to return a 404 on purpose, but it's rarely necessary or appropriate. The question here is whether you want a 410 ("it's gone") or a 301 ("go round the back"). Or whether you want to take an entirely different route, probably involving liberal use of "rel='canonical'".

:: Hm, 586 posts, how much slack do we cut him? ::
9:36 am on May 5, 2014 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



i'm surprised you can't get joomla to redirect those requests to the canonical url.
10:08 am on May 5, 2014 (gmt 0)

5+ Year Member



I want a 410 for all the pages with number.

Here is the code I tried but the issue I have is that the pictures in my module (rock sprocket ) disappear using this code.

RewriteCond %{REQUEST_URI} ^/(.*)[0-9]{1,3}(.*)$ [NC]
RewriteRule ^.*$ - [F,L]

Anything I could do differently ?

Thank you,
4:19 pm on May 5, 2014 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



That rule is much too broadly configured. I'm guessing the filenames of your images also contain numerals. Express the rule in a way that constrains it to pages. (Extensionless, .php or .html or whatever it is you use.) You don't need a Condition; this can go in the body of the rule.

If none of your filepaths contain literal periods, and you're using extensionless URLs, the pattern can be expressed simply as

\d[^.]*$

No opening anchor, no captures. Oh, and [F,L] isn't an error but it isn't needed: [F] implies [L].