Forum Moderators: phranque
but how can I do it with the url variables?
As the documentation [httpd.apache.org] states
mod_alias is designed to handle simple URL manipulation tasks. For more complicated tasks such as manipulating the query string, use the tools provided by mod_rewrite.
You can't check for an existing query_string with mod_alias. You can only substitute a new one.
You'll need a RewriteCond checking for %{QUERY_STRING}, the pattern of the RewriteRule directive matches against a local filepath in per-directory context. See the documentation [httpd.apache.org] for more details.
[edited by: Caterham at 9:11 pm (utc) on Jan. 6, 2009]
Options +FollowSymLinks
RewriteEngine on
#
RewriteCond %{QUERY_STRING} ^id=322&page=8978$
RewriteRule ^layout9\.asp$ http://www.example.com/panther-lake-course-information/index.php? [R=301,L]
Jim
I'm always trying to avoid using mod_rewrite if simple redirect tasks can be solved by mod_alias Redirect or RedirectMatch.
Which you should always do (KISS [en.wikipedia.org]). But unfortunately none directive provided by mod_alias can check r->args but only r->uri.
The supplied regular expression is matched against the URL-path.
mod_alias is designed to handle simple URL manipulation tasks. For more complicated tasks such as manipulating the query string, use the tools provided by mod_rewrite.
Another way to look at it is that a URL *locates* a resource on the Web. The query string plays no part in the location of the script, and is therefore not part of the URL.
mos_alias was written when dynamic Web sites were very rare or non-existent, and all (or most) based on primitive server-side includes (see mod_includes).
Jim