开发者

How to encode URL in Apache mod_rewrite?

开发者 https://www.devze.com 2022-12-08 05:44 出处:网络
I\'m now doing it this way: re开发者_开发百科writerule ^questions/tagged/(.*) qas.php?q=[$1] Which didn\'t do encoding stuff yet.I can\'t figure out what your question actually is asking, but since

I'm now doing it this way:

re开发者_开发百科writerule ^questions/tagged/(.*) qas.php?q=[$1]

Which didn't do encoding stuff yet.


I can't figure out what your question actually is asking, but since you know what you're looking for maybe you'll find it in condensed documentation like a cheat sheet.

My guess at answering your question, which I'm uncertain of, is:

rewriterule ^questions/tagged/(.*) qas.php?q=[$1] [L]
rewriterule ^qas.php?q=(.*) questions/tagged/[$1] [R=301,L]


I'm guessing you want to have $1 URL-encoded so it's valid as a query argument? You don't need additional encoding for that, as any character that is valid in the path part is also valid in the query part. So the rule you have there should suffice.


Try to use NE tag:

RewriteEngine On
RewriteRule ^questions/tagged/(.*) qas.php?q=[$1] [NE]
0

精彩评论

暂无评论...
验证码 换一张
取 消