Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

block some pages with htaccess

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

New User

5+ Year Member

joined:May 22, 2007
posts: 2
votes: 0

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

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?
1:56 am on Feb 13, 2013 (gmt 0)

Senior Member from US 

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

joined:Apr 9, 2011
votes: 244

Sure. You need a RewriteCond that says
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.

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.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members