0

I'm using a code snippet from the Invision Power Board forum software on my own site to, sort of, connect the two. I have a "member bar" that I wanna put on every page in my website that has a login link, profile link, etc. I've already done this, the only problem is that on the pages I want to implement it on, I have to put a ? after the ".php". So I need a mod_rewrite condition that turns

http://www.mysite.com/index.php into http://www.mysite.com/index.php?

http://www.mysite.com/html/about.php into http://www.mysite.com/html/about.php?

I know this is probably very simple, but I've tried to learn regular expressions and it gives me a headache every time I try haha.

Also, an aside question: for the index page, instead of doing http://www.mysite.com/index.php?, would http://www.mysite.com/? work as well?

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by almostbob
0

Out of curiousity, why does it need a blank "?", or are there goodies after that?

I ask because if there are GET variables after the ?, the rewrite could really mess stuff up by putting additional "?" into the URL.

Im adapting this from a lighttpd config, but I think this should be close.

RewriteRule ^[$/]$    /index.php?
RewriteRule ^/(.*)$    /$1?
RewriteRule ^/([^\?]*)\?(.*)$    /$1?$2

First line will take 'yoursite.com' or 'yoursite.com/' and turn into 'yoursite.com/index.php?'.

Second line takes anything and appends a '?' to it.

Third line is a better version of the second, but I'm not sure if you need it, or if it even works the way I meant. The idea is, if your scripts are using GET variables, we make sure that the final URL has only 1 "?" in it.

0

I'm actually not sure why it needs the question mark (?) at the end, when I didn't include it, I kept getting a blank page with the message "No input file specified."

0

the error message implies a bug in the code snippet, you are using, it is often simpler/safer (for the reasons outlide by petzoldt01) to modify the login code to accomodate a blank uri, than allow bugs to go forward.
post the scrap?

Edited by almostbob

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.