Jump to content
MakeWebGames

Recommended Posts

Posted

ok in my htaccess file this is the line i am having problem with

 

RewriteRule ^page\/(\d{0,5})\/?\-?(.*)?$ /page\.php?q1=$1&q2=$2

 

so as u can see by looking at it the url the page accessor will see is "http://www.website.com/page/(int)/"

and the url the server see's is "http://www.website.com/page.php?q1=(int)"

first of all everything works fine as is

...unless i enter a question mark somewhere in the url after the (int) then nothing after the question mark is captured

my problem is at the highlighted & underlined part of the line "RewriteRule ^page\/(\d{0,5})\/?\-?(.*)?$ /page\.php?q1=$1&q2=$2"

i want to change it to \? but when i do that nothing after that point is captured

any other charcter works just fine just not the question mark

is there something at that point i am doing wrong?

is there something in apache that may be configured wrong?

can apache just not handle "?" in the input url? (will i have to just find some other character to use?)

Posted

Through my fuzzy head from drinking too much last night 8o ....looks a bit long winded that rule.

RewriteRule ^page/([A-Za-z0-9-]+)/([0-9]+)/?$ page.php?q1=$1&q2=$2

 

You might not need the A-Za-z

Posted

What kind of url do you want to match? I don't understand why you will have a ? after the (int) part. Can you show some examples of urls you want to match and not match?

Posted

im echoing $_GET['q2'] to make sure its working write and

haunted dawg i tried what you said and...........

when i have nothing after the 2nd slash it echo's .php

if something does come after the 2nd / it echo's that unless there's a question mark in it.

then it either ignores anything after the question mark or if the question mark is at the begining it echo's .php

Posted

Try this:

RewriteRule ^page\/([0-9]+)\/\?(.+)$ /page\.php?q1=$1&$2
RewriteRule ^page\/([0-9]+)\/(.*)$ /page\.php?q1=$1

 

Matches:

page/(int)/ => page.php?q1=(int)

page/(int)/bla => page.php?q1=(int)

page/(int)/?bla=bla => page.php?q1=(int)&bla=bla

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...