2012-11-04 69 views
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] 

有人可以告訴我爲什麼這不起作用嗎?htaccess不工作 - 查看圖片

+0

歡迎堆棧溢出! –

+1

非常感謝。 :) – greeny17

回答

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] 
+0

似乎沒有工作... – greeny17

+0

建議是草案,我只是解釋了爲什麼你的一個不會工作,這是一個問題。啓用重寫調試來查找哪些不起作用 –