0

I have a .htaccess file. I have two RewriteRule's that do the same thing.

This one works perfectly, and can handle a huge query:

RewriteRule ^p/(.*)(/?)$ index.php?p=$1 [QSA,L]

This one will only handle a query up to 255 characters.

RewriteRule ^(.*)(/?)$ index.php?p=$1 [QSA,L]

How do I fix this, and make both handle a huge query?

3
Contributors
8
Replies
11
Views
4 Years
Discussion Span
Last Post by coreyavis
0

DO you have anything else in the file. Could you print out the entire .htaccess? REQUEST_FILENAME has been known to be involved with string length limitations.

0

I'd rather not give my entire htaccess file, but I can assure you that there are no Rewrite Conditions before it that affect these Rewrite Rules.

0

there are no Rewrite Conditions before it that affect these Rewrite Rules

OK, sorry, am stumped. Anybody else?

0

By "query", are you referring to the length of the value for p in the URL?

Does the value of p, when it doesn't work correspond to the name of another physical file?

E.g. if you visit /hello, is there a file called hello.php?

Can you provide some example URLs that work and fail?

When you visit one of the URLs that fail and var_dump the value of p in index.php, what does it show?

0

Yes, query does refer to the value of 'p' in the url.
The 'p' value is not another file, but a string of characters where each character represents a value.

The best way for me to provide some example url's that work and don't work is like this:
http://[sitename].com/p/[256+chars] (works)
http://[sitename].com/[256+chars] (doesn't work)
Both links are the same and provide a query of 'p'.

Just for reference, there is also a 'u' query:

# if request is short url
RewriteRule ^u/(.*)(/?)$ index.php?u=$1 [QSA,L]

# if request is p query
RewriteRule ^p/(.*)(/?)$ index.php?p=$1 [QSA,L]

# If request has 6 chars, make short url query
RewriteRule ^([a-zA-Z1-9]{6})(/?)$ index.php?u=$1 [QSA,L]

# If not short url query, make p query
RewriteRule ^(.*)(/?)$ index.php?p=$1 [QSA,L]

Edited by coreyavis: Changes

0

For the non-working url, it gives a 403 Forbidden error which is the same thing that happens when I do a var_dump of the value.

0

I understand that p is a character string. I was asking whether co-incidentally there was another, un-related file or directory for that matter, with the same name as the character string?

The 403 error hints at a permission problem. Most likely not with the index.php file, otherwise none of the other URLs would work either, but worth checking either way. Are the permissions for index.php 644?

If/when you're able to view index.php, if you var_dump the $_GET and $_SERVER global arrays, the output could be helpful to show how the file is being routed and what's being passed through the query string.

Other than that, I'm out of ideas without tinkering with it myself - sorry.

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.