View Single Post

  #7 (permalink)  
Old 07-23-2007
Paul Furman
 
Posts: n/a
Default Re: Cannot get basic RewriteRule to work!

Paul Furman wrote:
> Paul Furman wrote:
>
>> Paul Furman wrote:
>>
>>> I've tried a million things and the regex is I think what's stumping
>>> me. Here's a little simpler one: I'd like to be able to apply a
>>> simple freaking wildcard for
>>> ?SC=go.php&DIR=* [note my star wildcard at the end]
>>> ?SC=go.php&DIR=(.*)?????????
>>> ?SC=go.php&DIR=(.)??????????
>>> ????????????????????????????
>>>
>>> then for rewrite, I don't know how to tell it to replace that gunk
>>> with nothing. How do indicate "nothing"? do I need to create a little
>>> token in there so there's something to talk about & convert to
>>> [?SC=go.php&DIR=]? And I think I want to go both ways so if people
>>> type the long url it changes to the new short one & if they type the
>>> short one, it translates into the real long one on the server.
>>>
>>> I'm exasperated & making almost no progress. There is no such thing
>>> as 'regex for idiots' as far as I can tell.

>>
>>
>>
>> OK here's a simple one:
>>
>> RewriteRule ^?SC=go.php&DIR=(.)$ $1 [R]
>>
>> the (.) is supposed to indicate "anything" like *

>
>
> PS I just spent a few hours getting some tutoring on this, the (.)
> should be (.+) and what I wanted is not possible, I need to list the
> destination folders behind the query in the url, there is no way to just
> wipe it out. Fortunately there aren't that many top folders & I can make
> everything below follow the top rules. Unfortunately, now I need to
> change all my coding to absolute urls, ack what a nightmare. It's all
> php generated though so maybe not too bad.


PPS it's not that bad, all I had to do was get rewriterules for the
first level of folders & the rest falls in place.

>> the $1 is supposed to replace that minus the ?SC=go.php&DIR=
>>
>> I get this in the error log:
>> RewriteRule: cannot compile regular expression '^?SC=go.php&DIR=(.)$'
>>
>> Now if it worked, that would take me to a folder which does not exist
>> so I'd also need the reverse to follow this rule without the [R] In
>> this case there is nothing left to search for short of a full list of
>> all the possible paths that might follow [?SC=go.php&DIR=]. One thing
>> I could do is look for the /1/ because this all happens under /1/ but
>> I already set this:
>> RewriteBase /1
>> so I'm not sure if I can do that.
>>
>>
>>
>>

>
>



--
Paul Furman Photography
http://www.edgehill.net/1
Bay Natives Nursery
http://www.baynatives.com