Jump to content

Escaping the "?" character


mr_mind

Recommended Posts

This is not really a PHP question as much as an Apache question but regex is the same in both applications so here goes. I have this line of code in a .htaccess file

 

# To redirect everything to the index file to be loaded
RewriteRule ^s/(.+).php$ /new/index.php?uri=$1
# I added this in to fix query strings so we dont get stuff like
# http://www.example.com/new/index.php?uri=news?show=all
# Which would not be fun
RewriteRule ^s/(.+).php\?(.+)$ /new/index.php?uri=$1&$2
# But currently the "\?" is not sufficient because in this instance it is searching
# it looks for http://www.example.com/new/s/file.php
# and http://www.example.com/new/s/file.php\
# 
# What i want to do is
# http://www.example.com/new/s/news.php?show=all
# but that does not work. Though this does
# http://www.example.com/new/s/news.php\show=all

Link to comment
https://forums.phpfreaks.com/topic/94391-escaping-the-character/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.