Score:0

htaccess: I need urgent help to remove %3f behind via form submit query generated urls

sj flag

3 years with hosting at a2hosting. Today I noticed that every form query ends with %3f at the end of the generated url, which makes a 404. This happened suddenly.

This is my htaccess code that works for a years withotu any issue. It remove .php as extension, remove ?check= and replace it with /

# To externally redirect /site.com/foo.php?find=123 to site.com/dir/foo
RewriteCond %{THE_REQUEST} ^GET\s([^.]+)\?check=([^&\s]+) [NC]
RewriteRule ^ %1/%2? [R=301,L]

# To internally forward /site.com/foo.php?find=123 to site.com/dir/foo
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/([^/]+)/?$ $1.php?check=$2 [L,QSA]


# Remove .php extension
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L] 

Code works to change for example query

from
https://www.whatever.org/whatever.php?check=msn.com

to
https://www.whatever.org/whatever/msn.com


Right Now i get 
https://www.whatever.org/whatever/msn.com%3f

I really need to remove %3f

kz flag
Although the _cause_ does not seem to be your `.htaccess` file?
Sharon Creech avatar
sj flag
The cause of the problem, however, was my htaccess file. Strange, but that's how it is. The most important thing is that the problem has been solved
Score:0
sj flag

Update.

After playing with htaccess code for some time it seems that this works. Changing

# To externally redirect /example.com/foo.php?find=123 to example.com/dir/foo
RewriteCond %{THE_REQUEST} ^GET\s([^.]+)\?check=([^&\s]+) [NC]
RewriteRule ^ %1/%2? [R=301,L]

to

# To externally redirect /dir/foo.php?find=123 to /dir/foo
RewriteCond %{THE_REQUEST} ^GET\s([^.]+)\?check=([^&\s]+)(?:&(\S+))? [NC] 
RewriteRule ^ %1/%2?%3 [R,L]

solved the issue and %3f behind query generated url is gone.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.