I've found a rewrite rule that *works*, except ONLY if I append an "R" flag (e.g. R=301), which makes the ugly "dynamic" versions of the URL appear in the URL bar, rather than retaining the input "static" URL. If I omit the "R" flag, the correct code is sent to the browser (viewing the source confirms this), but the page is BLANK.
Using AAA, BBB, CCC, and DDD for simplicity of reading, here is the rewrite:
- Code: Select all
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^b([0-9-]+)/d([0-9-]+)/?$ /aaa.php?bbb=$1#ccc.php?ddd=$2 [NE,NC,L,R]
Thus, if I enter:
- Code: Select all
mysite/b123/d456
...it will translate correctly to:
- Code: Select all
mysite/aaa.php?bbb=123#ccc.php?ddd=456
Notice I have to use the NE flag because of the # character in the dynamic URL; NC allows case insensitivity; and L stops subsequent rewrites from being considered.
The problem is that if I omit the R flag, the browser screen goes blank; viewing the source reveals that everything was delivered to the browser correctly (i.e. all the webcode is there), but nothing displays...and refreshing makes no difference.
When the R flag is included, the same webcode is served to the browser, but magically everything displays as it should...yet, unfortunately, the "static" (shorthand) URL is replaced with the "dynamic" (longhand) URL in the URL bar. I want the "static" URL to remain.
I've checked the error logs and no errors are reported.
What could be causing this problem?