Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L]
RewriteRule ^([^/]+)/$ view_image.php?rand=$1 [L]
なぜこれが機能しないのか誰かに教えてもらえますか?
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L]
RewriteRule ^([^/]+)/$ view_image.php?rand=$1 [L]
なぜこれが機能しないのか誰かに教えてもらえますか?
インラインで回答します
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]