Re: Apache and RewriteRule

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

 



Hi,

Alex wrote:
> I've already asked this question on a number of apache forums and have
> received no response. I hoped someone here could help me understand
> why this rewriterule doesn't work:
> 
>       RewriteRule ^/index.php\?option=login$  /register       [R=301,L]

I think you may be caught by RewriteRule not matching
against query strings. Per the docs:

    What is matched?
        ...
        * If you wish to match against the hostname, port,
          or query string, use a RewriteCond with the
          %{HTTP_HOST}, %{SERVER_PORT}, or %{QUERY_STRING}
          variables respectively.

Source:
https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#what_is_matched

I believe you want to use something like:

    RewriteCond %{QUERY_STRING} ^option=login$
    RewriteRule ^/index.php?$   /register       [R=301,L]

It's been a while since I've done this, so I'm not sure
whether the "?" after index.php is matched.  You may need to
adjust that pattern.

-- 
Todd

Attachment: signature.asc
Description: PGP signature

_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux