homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Rule to write

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

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)

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)

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)

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)

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


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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

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