Apache Web Server Forum

Ok, I am trying to redirect a number of old, deleted files to the main page of my site. The problem is that I have the redirection working properly, but the variables are still being passed and I don't want this to happen. Example:

I have this line in .htaccess -

redirect permanent /forummessage.php http://www.example.com/

The problem is that it will redirect to www.example.com, but it will carry the variables over from forummessage.php if they click from Google.

So let's say that a page was forummessage.php?aid=17. Now, when I redirect, it is going to www.example.com?aid=17. I don't want the $aid to show up anymore. Any ideas? Thanks.

Right, it's carrying the part of the URL after .php with them, that's what happens even if redirecting between subdirectories. Are all the URLs you're redirecting consecutive numbers, or are the some with numbers in between that are being left where they are? And about how many are there you're redirecting, just a few?

Basically we completely re-did a really old site. There are something like 300 pages which don't exist any more. Any new files are under a completely different naming format. Should I just leave them and leave Google kick them out over time? I am not concerned about any traffic, I just want to do this in the right way so Google doesn't punish our site. Thanks,

You really aren't permanently moving them (301), you're eliminating them altogether, which techically, if you look at the documentation, would be a 410 permanently removed.

If you really don't care at all about PR or traffic, 410 is fine, but I personally *for sure* wouldn't use the homepage as the target URL of a 404 or a 410 redirect. I'd do a custom 410 error page of some sort, not only for search engine purposes, but so that anyone who tries to reach one of those old URLs in the future will see that they're gone and know where on the site to continue if they wish. A custom 410 page would accomplish that.

Another thing is that 300 URLs is a *whole* lot of URLs to be doing individually in .htaccess; so given that it's all of 300 URLs with the same URL pattern, you'd be better off using an Apache directive that supports regular expressions, which would enable you to specify the entire range of pages you've eliminated using only a couple of lines of code in .htaccess for far more efficiency and far less work.

mod_rewrite is regex based and would work, and it looks like there are some other directives in mod_alias that support regular expressions as well, and there could be other modules suited to this purpose. But this is where someone else will have to step in tell you the best, most efficient way and how to do it.