Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Apache
Author Message
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Wed Mar 05, 2008 9:54 am Reply with quote

I know this is going to be really simple buy I just cannot see the wood for the tree's....
I have a script which outputs a url;
Code:
/reviewer_about/Guardian.php?


The link is formulated from the construct
Code:
/reviewer_about/$username2.php?


The current re-write rule is;
Code:
RewriteRule ^reviewer_about/([^/])\.php reviewer_about.php?username=$username2  [QSA,L]


The correctly re-written link should be in the form of
Code:
/reviewer_about.php?username=Guardian


Anyone have any idea's where the re-write rule is failing or why?
Personally I don't think it's worth bothering re-writing this but that is how the original author has done it and it will save me recoding about 20 files if anyone can help.
 
View user's profile Send private message Send e-mail
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Wed Mar 05, 2008 3:58 pm Reply with quote

Have you tried turning the log level on to see exactly where the rule is going wrong? This can't be done in .htaccess. It must be done in httpd.conf.

Add these two directives to your httpd.conf immediately after RewriteEngine On
#
# name it whatever you want
#
RewriteLog “/some_path/rewrite_log”
#
# can be 0-9. The higher the number the more verbose
#
RewriteLogLevel 3
 
View user's profile Send private message
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Wed Mar 05, 2008 6:37 pm Reply with quote

Guardian, I am not sure what QSA is, but that rewrite rule does not look right to me. Does the following work?

RewriteRule ^reviewer_about/([^/.]*)\.php reviewer_about.php?username=$1 [QSA,L]

I won't really like how open that is, so if you had restrictions on user names, you might want to restrict that rule a bit.

Edited: I also added in the "." in-between the []. If it causes issues, take it out.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
montego







PostPosted: Wed Mar 05, 2008 6:40 pm Reply with quote

Just looked up QSA. Sorry... should have done that previously. My question to you is do you really need it? If you take the "QSA," out of my rule, doesn't it work?
 
Guardian2003







PostPosted: Thu Mar 06, 2008 12:48 am Reply with quote

Thanks for the info guys, I'll be checking all this out as soon as I have woken up properly.
M you could be right about not needing QSA, I think someone just got hold of the fact that "it will append any variable between a pattern match to the end of the url" and went with it instead of looking deeper.
The username is restricted to alpha-numeric.
I can see how QSA might be useful in nuke as an example if you wanted to pass $title or something with useful SEO content to the end of a url (food for thought?) but this thing only passes the username and for other stuff an integer is used so the usefulness for SEO is questionable in my eyes.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Apache

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©