On 4/1/2014 1:15 PM, James Moe wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I have changed the way a website refers to page in the URL. The old method was odd, useless and unnecessarily complicated. I wish to have rewrite rule that changes http://www.example.com/?page=somepage.php to http://www.example.com/somepage.php I've gotten this far: RewriteEngine on RewriteCond %{QUERY_STRING} =page RewriteRule ^(.*)$ <<now what?>> [R,L]- -- James Moemoe dot james at sohnen-moe dot com 520.743.3936 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlM7Ai8ACgkQzTcr8Prq0ZOwOACfbu7cB3WnjXxnHVu31tXAy3x/ yb8AniivPndcI3EYAtiNtX5S95IwOdPo =ZUou -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
Try this: RewriteEngine on RewriteCond %{QUERY_STRING} page=(.*) RewriteRule ^(.*)$ http://www.example.com/%1? [R,L]Here is what mod_rewrite is doing behind the scenes when you try that with http://www.example.com/?page=somepage.php
strip per-dir prefix: /path/to/document_root/ -> RewriteRule: applying pattern '^(.*)$' to uri '' => matched RewriteCond: input='page=somepage.php' pattern='page=(.*)' => matched rewrite '' -> 'http://www.example.com/somepage.php?'split uri=http://www.example.com/somepage.php? -> uri=http://www.example.com/somepage.php, args=
explicitly forcing redirect with http://www.example.com/somepage.php escaping http://www.example.com/somepage.php for redirect redirect to http://www.example.com/somepage.php [REDIRECT/302] --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx