Forum Moderators: phranque
RewriteRule ^/A(.*) /links/frame.php?action=A&id=$1
This ensures that urls are re-written as follows:
[mysite.com...]
is rewritten as
[mysite.com...]
Some of the pages to which the url is re-directed contain forms, and I would like to change the rule so that it allows this:
[mysite.com...]
rewritten as
[mysite.com...]
Any ideas how I can achieve this? Not all URLS will contain additional queries.
At the moment I do not know what the additional queries might be - they will vary.
SMB
RewriteRule ^/A(.*) /links/frame.php?action=A&id=$1&%{query_string}
This completes the re-write correctly. I had read that I should have put $%[query_string} at the end but this made the query string read:
action=A&id=1?query=2
which meant the final query was just ignored.
Anyway I've discovered that anchors within the returned pages don't work. I was under the impression that anchors worked without referring back to the server. Now I have my forms working again it would be nice for me to get the [top] links working as well. Any ideas?
Sure, start with the long ones and work on down to the short ones if the first pattern matches fail due to missing parameters. Something like this:
RewriteCond %{QUERY_STRING} ^query1=(.+)&query2=(.+)$
RewriteRule ^/A([0-9]{3})$ /links/frame.php?action=A&id=$1&query1=%1&query2=%2 [L]
#
RewriteCond %{QUERY_STRING} ^query1=(.+)$
RewriteRule ^/A([0-9]{3})$ /links/frame.php?action=A&id=$1&query1=%1 [L]
#
RewriteRule ^/A([0-9]{3})$ /links/frame.php?action=A&id=$1 [L]
The above are written as internal redirects, and assume that the code is in httpd.conf. Remove the leading slash on the RewriteRule patterns for use in .htaccess context. The rules also assume a three-digit number for the ID; you can also set a minimum and maximum acceptable number of digits by specifying min,max, as in [0-9]{1,4}
Jim
<edit> Hah! Cross-posted. My reply is intended for your first post. </edit>