문제

I have a very strange problem in my current custom PHP MVC project. If a controller methodname contains show (fx show_album), apache throws a 404 page not found?

Du you have any ideas why this happens?

.htaccess:

#mod_rewrite start
Options +FollowSymLinks

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z]*)/?([a-zA-Z]*)?/?([a-zA-Z0-9]*)?/?$ index.php?controller=$1&action=$2&id=$3 [QSA,L]
#mod_rewrite end

Btw. it works with normal get request in url (like index.php?controller=profile&action=show_album&id=1

도움이 되었습니까?

해결책

Your problem is likely not to be the word show and more likely to be the underscore in show_album - your patterns in htaccess won't match underscores.

Try the following patterns with underscores added.

#mod_rewrite start
Options +FollowSymLinks

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z_]*)/?([a-zA-Z_]*)?/?([a-zA-Z0-9_]*)?/?$ index.php?controller=$1&action=$2&id=$3 [QSA,L]
#mod_rewrite end
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top