I'm not sure of the syntax to use wildcards for strings, especially if an extension may or may NOT be entered (XXXX.[extension]) or just nix any string with (XXXX*)
Then, it gets more confusing to screen any string BEGINNING with, or CONTAINING (whatever characters) you are trying to screen for.
I see there was a post a couple weeks ago without a response (that I can see.) Help, ideas, recommendations are very, very appreciated. I'd like to use .htaccess to redirect by strings.
Thanks!
Idiotgirl
If the XXXXX that you are referring to is from a referral string of /default.ida?XXXXX....., then that is a request from a webserver that is infected with the code red virus. It is probably best just to send it the 404 error.
Though I'm flattered at all the attention, I'd just as soon they went somewhere else. So, I'd like to take the prelims of strings from my logfiles and use .htaccess to redirect.
I went and looked on Apache's site, but I'm confused as to what goes where as far as my syntax goes, what goes in the brackets for wildcards, etc. I want to keep it as general as possible, such as strings beginning with particular characters are redirected to:
[server...]
where a script parses, logs, and responds to the request (I already did that script.)
Thanks,
Idiotgirl
RedirectMatch .*\.php$ [cert.org...]
That would redirect all requests for files ending in ".php" to
CERT's homepage. Is that what you mean?
Dear Bolotomus-
In re:
RedirectMatch .*\.php$ [cert.org...]
I think RedirectMatch just matches whatever was input and redirects to the same filename or call in another location, perhaps with a different file extension. I've been wrong more than once, so I may be waaay off on that one.
So, I'm wondering if what I really need to do is take a more aggressive step and do a:
RewriteEngine (blah)
RewriteCond (blah blah)
RewriteRule (blah blah blah)
which still leaves me virtually lost for correct wildcard syntax, the fact there may or may NOT be a file extension given, though now I'm lost in another direction ;)
While I can hold my own in several areas, this whole Apache htaccess rewrite business is unknown territory for me. I'm confused as to what is the thing that is appropriate in this case.
This htacess file is in my root directory, if that is somehow meaningful.
Thanks,
Idiotgirl
redirectMatch xx*\.shtml$ [mydomain.com...]
The pattern you have will basically grab all files that are like; xx.shtml or xxxxxxxxx.shtml etc and redirect (eg. any number of x's).
Try this: [perl]redirectMatch xx.*\.shtml$ [mydomain.com...]
Though it would also redirect files like hello-xx-test.shtml
Not a trick, I tried it with/without the leading period. I'll try your suggestion now.
Actually, the file names have a the actual letters 'xx' in them. They are old military base locator files which I renamed with a leading 'xx' years ago when I acquired a site and replaced them. Recently, with the INK shift at AOL they've gone hot-hot-hot. I need to redirect to the new query page. All are in the same directory tree (including the new pages). The only unique characteristics they have are the xx.