Post #355,836
3/26/12 4:17:59 PM
3/26/12 4:18:32 PM
|
Somehow I can't read docs for Apache and RewriteCond/Rule
ReWriteCond %{QUERY_STRING} ^pagename=Urgent_Bloating_Gas
ReWriteRule ^/(.*) http://www.somedomain.org/UBG [R=301,L]
First off I don't particularly about any Query String, nor do I care what the original URL was, only thing I care about is this:
If *ANY* variable in the query string arguments = something, I want a hard redirect to this particular web-server and this particular URI.
For some reason... this setup ain't workin' and I;ve got a "novel" full of these I have to make.
http://www.somedomain.org/diff_non-qs-redirect?pagename=Urgent_Bloating_Gas
Bleah.
Edited by folkert
March 26, 2012, 04:18:32 PM EDT
|
Post #355,843
3/26/12 5:05:06 PM
|
Can't you do a partial match?
*=Urgent_Bloating_Gas[&\b]
IOW if it's "=" followed by your string followed by an ampersand or a word boundary then it's a variable.
--
Drew
|
Post #355,852
3/26/12 7:35:39 PM
|
Re: Somehow I can't read docs for Apache and RewriteCond/Rul
since you dont care about the string, this should work
ReWriteRule ^pagename=Urgent_Bloating_Gas(.*) http://www.somedomain.org/UBG [R=301,L]
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free American and do not reflect the opinions of any person or company that I have had professional relations with in the past 55 years. meep
|
Post #355,853
3/26/12 7:45:39 PM
3/27/12 8:50:31 AM
|
Re: Somehow I can't read docs for Apache and RewriteCond/Rul
Actually:
http://www.thisdomain.org/site/Pages?pagename=Urgent_Bloating_GAS
Need to goto:
http://www.somedomain.org/UBG
I'm taking a break for a few hours... thinking about it. I'm sure I'll fix it... but please anyone else?
There are about 250 of the specific pages... from one old domain getting transferred to a new domain, with *COMPLETELY* disparate mechanisms. The old one SUCKED... the new one uses QS to do functions rather than display content.
Edited by folkert
March 27, 2012, 08:50:31 AM EDT
|
Post #355,862
3/26/12 10:08:11 PM
|
email be the url got minged
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free American and do not reflect the opinions of any person or company that I have had professional relations with in the past 55 years. meep
|
Post #355,855
3/26/12 8:11:40 PM
|
The commands are case sensitive
Try RewriteCond and RewriteRule
Also, the caret in the RewriteCond rule will limit a match to the first parameter while you're looking for a match in any pair. Last, as you don't care about the original URL, the RewriteRule match can be set to ^$. That'll match anything you throw at it.
|
Post #355,873
3/27/12 11:45:38 AM
|
Re: The commands are case sensitive
Ok... thanks... I fixed that along with the resolution. (DUH on that..., what I get for being in a Perl World)
|
Post #355,872
3/27/12 11:42:17 AM
|
Resolution.
Well damn. I was being to literal, plus I was doing everything... and nothing. Here is what ended up working.
To rewrite this:
http://www.thisdomain.com/site/PageServer?pagename=Urgent_Bloating_Gas
To this:
http://www.somedomain.org/UBG
and to scrub the Query String from the rewrite, causing this:
http://www.somedomain.org/UBG?pagename=Urgent_Bloating_Gas
In the www.thisdomain.com httpd config:
RewriteCond %{QUERY_STRING} pagename=Urgent_Bloating_Gas
RewriteRule ^/site/PageServer http://www.somedomain.org/UBG? [R=301,L]
The Question mark at the end of the destination URL, clears the Query String.
The R=301 makes SEO peeps swoon (Redirect response code 301 and Moved Permanently)
The L means this is the last rule to process if it matches.
|
Post #355,887
3/27/12 3:48:05 PM
|
Proof.
In my mind at least, your adventures are proof that rewrite rules are a bandaid on a hack and best avoided if at all possible. :-/
Wade.
|
Post #355,889
3/27/12 4:08:26 PM
|
very useful when an app doesnt have the capabilities
these days an app that doesnt have the capabilities should be ash canned
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free American and do not reflect the opinions of any person or company that I have had professional relations with in the past 55 years. meep
|
Post #355,893
3/27/12 6:03:27 PM
|
Agreed... but.
Many places just don't have the capital to just replace apps. And need to just make due.
|
Post #355,892
3/27/12 5:58:55 PM
|
Its more that...
The organization wanted to get away from the previous application that did the Website for them. Charging US$21,000 per year for an essentially static website...
They are having to support the old website... and point all the "pages in Google" to the proper pages at the new merged site.
They are paying an SEO/Marketing firm a ton of money and they had this arm-lengths long list of *CRITICAL* old URLs that had to be redirected to the proper location.
|
Post #355,894
3/27/12 6:57:46 PM
|
I feel your pain.
I've fought SEO URL battles before, too. I've made sure we have URL handling tricks (for database-driven data!) in the app so we don't have to do that sort of shit in rewrite rules.
Wade.
|