Forum Moderators: phranque

Message Too Old, No Replies

Two Rewrites that are not getting along

         

Nosmada

3:13 pm on Jul 26, 2005 (gmt 0)

10+ Year Member



# This rewrite is working

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.+$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ cgi-bin/script1/script1.pl?merch=merchant&dir=&path=$1 [L]

# This rewrite is not working unless you take the above rewrite out

RewriteRule ^(.*).shtml$ /cgi-common/script2/script2.cgi?template=template.html&keyword=$1

...the first rewrite essentially takes any directory below root, say [mydomain.com...] and makes the script create the page.

the second rewrite essentially takes any .shtml page below root, say [mydomain.com...] and rewrites it so that "script 2" creates the page.

They both work on their own but not together. Any help would be much appreciated. I've lost a lot of sleep:-)

Longhaired Genius

3:53 pm on Jul 26, 2005 (gmt 0)

10+ Year Member



Have you tried putting rewrite 2 first in the file?

jdMorgan

9:35 pm on Jul 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



...the first rewrite essentially takes any directory below root, say [mydomain.com...] and makes the script create the page.

No, the first RewriteRule causes the second one (and any others after it) to be skipped if the requested filename is non-blank and exists as a directory.

If you will state what you are trying to accomplish with each rule and in combination, we may be able to provide more help. But please review the documentation cited in our charter and make sure you understand what your code is doing first. The code may be good, but it may not be intended to do what you want it to do.

Jim