Forum Moderators: phranque
[domain.com...]
I'd like all of these pages to redirect to a single page at:
[subdir.domain.com...]
However, the rewrite rule that I'm currently using adds the "?id=2895" to the new URL so that I end up with:
[subdir.domain.com...] (I don't want this)
Here's the RewriteRule I'm using
RewriteRule ^file.* [subdir.domain.com...] [R]
For every page with the above structure, I simply want a redirect to the single subdomain page with no dynamic content attached.
Any suggestions?
I'd also suggest that you redirect to appropriate replacement pages, rather than the single home page, and use a 301-Moved Permanently redirect to do so; Otherwise this exercise may be seen as an attempt to promote your site by using the same URL to access duplicate content... Search WebmasterWorld for "duplicate content" for more information about the trouble this can cause.
If an appropriate replacement page is not available, then returning a custom 410-Gone page with a brief and friendly explanation and a link to your site map, home page, and/or product category page is a better practice.
Jim
Changes made to .htaccess
**************************
ErrorDocument 410 /gone.html
RewriteRule ^file.* [domain.com...] [G]
**************************
(I don't think the? is necessary, but I had already put it in and it worked.)
In case you didn't know the [G] indicates that this is a 410 - Gone error (permanent) and the "ErrorDocument 410 /gone.html" just specifies a custom 410 error document.
Custom error document created and uploaded to current home directory:
**************************
gone.html
**************************