Forum Moderators: phranque

Message Too Old, No Replies

What am I doing wrong?

Trying to send two differnt URL's to the same target

         

calvinmicklefinger

10:56 pm on Jan 24, 2005 (gmt 0)

10+ Year Member



I have the following in my .htaccess

DirectoryIndex cgi-bin/y/d.cgi/?index-IPP10000 index.htm
RewriteEngine on
Options +FollowSymlinks -Indexes
RewriteBase /
ReWriteRule ^manager$ manager [L]
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?mydomain\.com/.*$ [NC]
RewriteRule \.(gif¦jpe?g¦png¦bmp)$ - [F,NC,L]
RewriteRule ^\.htaccess$ - [F]

# MyRule 1
RewriteRule ^cgi-bin/y/d.cgi/?([a-z]+)-IPP([0-9]+)$ - [NC,L]
# MyRule 2
RewriteRule ^([a-z0-9]{5})/([a-z0-9]*)/?$ Kcontent.php [NC,L]
# MyRule 3-4
ReWriteRule ^([a-z0-9]+)/?$ 10000/$1.php [NC]
RewriteRule ^10000/([a-z0-9]+)/?$ Kcontent.php [NC,L]

When I send [mydomain...] MyRule 2 correctly directs the request to Kcontent.php.

When I send [mydomain...] the page returns a 404 not found. I have also tried using %1 as the variable. I was expecting MyRules 3-4 to reform the request and direct it to Kcontent.php also.

What am I doing wrong?

Many thanks.

jdMorgan

11:16 pm on Jan 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




# MyRule 3-4
ReWriteRule ^([a-z0-9]+)/?$ 10000/$1.php [NC]
RewriteRule ^10000/([a-z0-9]+)/?$ Kcontent.php [NC,L]

Rule three will rewrite /main to 10000/main.php
Rule four will then fail, because 10000/main.php does not match ^10000/([a-z0-9]+)/$ or ^10000/([a-z0-9]+)$
This is because the pattern ([a-z0-9]+)/?$ will not match the trailing ".php" as required.

Jim

calvinmicklefinger

12:16 am on Jan 25, 2005 (gmt 0)

10+ Year Member



Oh piddle.

That was it.

Thanks Jim.