Re: [users@httpd] Using mod_rewrite with redirect

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

 



On 5/25/06, Bob Smith <idonotwantany@xxxxxxxxx> wrote:
Hi all.  I have been successfule in setting up mod_rewrite the way I needed
too, but now I'm trying to use 'redirect' and mod_rewrite in the same
directory.  There are two requests that I need to do special redirects on,
so I'm not handling them with the 'all-in-one' rewrite.  Maybe it's best I
show you...

------  .htaccess ------
redirect 301 /shoppingcart/customer/pages.php?pageid=62
http://www.kegworks.com/home.php?cat=663
redirect 301 /shoppingcart/customer/pages.php?pageid=63
http://www.kegworks.com/company.php?pageid=34

RewriteEngine On
#RewriteCond %{REQUEST_FILENAME} /shoppingcart/customer/ [NC]
RewriteRule ^(.*)$ /$1 [QSA,R=301]
------  .htaccess ------

It does what I need it to do for all the other pages, but it just seems to
ignore the two redirect commands, and shows this in the log file...

129.44.255.58    -       -       [25/May/2006:14:13:32 -0400]    GET
/shoppingcart/customer/pages.php?pageid=663 HTTP/1.1  301
  331     -       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8)
Gecko/20051111 Firefox/1.5

 129.44.255.58   -       -       [25/May/2006:14:13:33 -0400]    GET
/pages.php?pageid=62 HTTP/1.1        302     5       -       Mozilla/5.0
(X11; U; Linux i686; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

I have hit the brick wall.

Don't mix Redirect and RewriteRule; the order-of-processing can
confuse things.  The capabilities of RewrietRule are a strict superset
of those of Redirect, so there is no reason to use Redirect.  Convert
your Redirects into RewriteRules with the flags [R,L] on the end.  In
addition, neither Redirect nor RewriteRule will match against the
query string.  You need to add a RewriteCond %{QUERY_STRING} to do
that.

Joshua.

---------------------------------------------------------------------
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