Forum Moderators: phranque
i have tried search.php?s=this+%26+that and it picks everything up fine, the problem occurs when a url like /search/this+%26+that/ is used.
here is my rewrite:
RewriteRule ^search/(.*)/$ /search.php?s=$1 [NC]
The usual fix is to use the [NE] flag on the RewriteRule, but I strongly recommend that you follow the HTTP specification and eliminate the ampersand (and any other reserved characters) from your static/SE-friendly URLs. Consider using slashes, hyphens, underscores, and/or periods instead, as these characters are unreserved.
Jim
create rule/ruleset that would change
http://www.example.com/url/http://www.test.com/page1.php?p1=a&p2=b
to
http://www.example.com/url.php?url=http://www.test.com/page1.php%3fp1=a%26p2=b
so that if I wrote the following code in url.php
<?=$_SERVER['QUERY']?>
I would get
url=http://www.test.com/page1.php%3fp1=a%26p2=b
as the content of the page?
I tried
RewriteRule ^url/(.+)$ /url.php?url=$1 [QSA]
and the result is
url=http://www.test.com/page1.php&p1=a&p2=b
Is there any way to achieve it?
The best advice I can offer in this thread is this: Do not try to fight the HTTP protocol specification; You will cost yourself a lot of time, money, and frustration dealing with compatibility problems. If you want your site to work properly now and in the future, and you want to achieve and maintain good search ranking, stick with the standards.
See the following:
RFC2396 - Uniform Resource Identifiers (URI): Generic Syntax [faqs.org]
RFC2616 - HTTP/1.1 Protocol [w3.org]
Jim