homepage Welcome to WebmasterWorld Guest from 54.243.13.30
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
block some pages with htaccess
saudiqbal




msg:4544850
 8:45 am on Feb 12, 2013 (gmt 0)

I used to have php script which made dynamic pages like this.

domain.com/?keyword-one,23
domain.com/?another-keyword,43
domain.com/?one-more-keyword,23
and so on

the problem is that I have removed the script from my server and I have static html pages like index.html and the above pages are still works because of that ? after the first / because the server is attaching those files as domain.com/index.html?keyword-one,23

They are all indexed by search engines and I dont want 50 duplicate content from my index.html pages cuz all the above pages displays default html page /? <- because of that.

is there any way to show error 410 gone using htaccess?

I used RewriteRule ^index.html$ - [R=404,L,NC] and it is not working.

Then I tried RewriteRule ^/?$ - [R=410,L,NC] and it works but if I type www.domain.com then I get the error page and it does not open default index.html page.

Is it possible if the url contains ? then just throw a 410 page?

 

lucy24




msg:4545128
 1:56 am on Feb 13, 2013 (gmt 0)

Sure. You need a RewriteCond that says
%{QUERY_STRING} .
meaning "If a query string exists at all"

As an alternative to the 410, you can have a rule with the same Condition and instead redirect to the query-less form of the page. Which is, of course, not /index.html but simply / You would still need the Condition, so you don't go around in circles.

You can also go into gwt-- and equivalent for other major search engines-- and tell them to ignore certain parameters. I don't know if there's an option for "ignore ALL parameters" so I hope you don't have a vast number of them.

because the server is attaching those files

This line worries me, because it cannot be true. That is: sure, the server might be attaching query strings. But only if you tell it to. Whether or not that was what you intended to tell it.

Chorus:
I really hate that damned machine
I wish that they would sell it
It never does quite what I want
But only what I tell it.

Ongoing head-scratcher: The above jingle sounds, stylistically, as if it was composed several decades before computers took a prominent place in business-- but it cannot apply to anything other than computers.

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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved