[svlug] gotten myself in trouble with permalinks,

Kellner, Peter Peter at PeterKellner.net
Sun Mar 26 22:57:55 PST 2006


Tin Le,

Thank you very much for all the time you have put into helping me.  I
really don't need a general solution at all.  Just for cases where
people have referenced specific articles and I still get referrals from
them.

I also tried the file you sent me in my .htaccess and as you said, it
didn't work.  I forwarded it on to DreamHosts support.  Maybe they will
take a look at it.


Thanks again, and I do appreciate all the time you have spent.

Good Night.

-Peter

-----Original Message-----
From: Tin Le [mailto:tin at le.org] 
Sent: Sunday, March 26, 2006 10:26 PM
To: Kellner, Peter
Cc: svlug at lists.svlug.org
Subject: RE: gotten myself in trouble with permalinks,

An interesting problem it is.

> Thanks for everyones help.  I'm not quite there yet.  (though just a
> little smarter on reg. exp.  I did download the tool and it appears
> [?]p=24 matches ?p=24 so with that in mind I'm trying to get this:
>
> http://test.cyclohamster.com/?p24
>
> to redirect to
>
> http://test.cyclohamster.com/xxx/bearflag.jpg
>
> I created a one line .htaccess file (after reading
> http://www.sitepoint.com/print/guide-url-rewriting
> 
>
> RewriteRule [?]p24 /xxx/bearflag.jpg

It's not going to work.  You are running into basic HTTP specs.  The
?p24 
or ?p=24 part is the QUERY_STRING part of a GET.  Specifically, it is
not 
consider a part of the URI.  The URI is http://test.cyclohamster.com/
and 
the QUERY is ?p24.

Soooo... to make a long story short.

RewriteCond %{QUERY_STRING} ^p=24
RewriteRule ^.*$ /bearflag.jpg [R]

Those two lines is the basic rewrite recipe.  You will need to add salt,

pepper and water to taste.

If you want a generic "p=SomeNumber", then it is something like this.

RewriteCond %{QUERY_STRING} ^p=\d+
RewriteRule ^.*$ /bearflag.jpg [R]

The only oddity I've noticed is that the recipe works fine _IN_ the
server 
httpd.conf, but does not work for me in .htaccess.  I played with it for
a 
bit, but don't feel like spending a lot of time on making .htaccess
work. 
I put in a lot of time taking them out of my site... so kinda waste of 
effort to make them work again!

Cheers,
Tin Le
-- 
http://tin.le.org
Tin Le - tin at le.org
Firewall and Security Consulting





More information about the svlug mailing list