0
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L]
RewriteRule ^([^/]+)/$ view_image.php?rand=$1 [L]

なぜこれが機能しないのか誰かに教えてもらえますか?

4

1 に答える 1

0

インラインで回答します

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#next  is last rule [L], 
#all works like following:
#helloworld/ -> helloworld/.php
#helloworld/helloworld -> helloworld/helloworld.php
#image.png -> image.png.php
RewriteRule ^(.*)$ $1.php [L]
#next rule never fires, as 1st rule ooverride it
#and if it would be before previous it will fire only to 1st word:
#image -> skipped
#image/ -> view_image.php?rand=image
#image/image -> skipped
RewriteRule ^([^/]+)/$ view_image.php?rand=$1 [L]
于 2012-11-04T00:45:06.870 に答える