Re: use mod_rewrite to answer a.php?xyz and serve /xyz ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 14, 2008 at 23:07, Randy Grimes <randygrimes15@xxxxxxxxx> wrote:
> Hi, I know mod_rewrite can answer web request to /xyz and internally serving
> a.php?xyz .  However, is it possible to answer a.php?xyz and internally
> serving /xyz , without writing a script a.php?  For the curious minds, we
> are moving from dynamic scripts to pre-generated static pages, and want to
> maintain old links to outside.

You can do this. Know though that the RewriteRule only works on the
URL, and ignores the query string. You can use the query string in
RewriteCond lines though.

So you could use something like this:

RewriteCond %{QUERY_STRING}       ^(.+)$
RewriteRule  /a.php    %1

Basically what this rule does is chekc if the url matches a.php and if
it does then it checks if the QUERY_STRING is at least on charachter
long, capturing it in the process. If that is the case the URL is
replaced with the captured query.

Krist


-- 
krist.vanbesien@xxxxxxxxx
krist@xxxxxxxxxxxxx
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux