Php 无法重写MVC项目的url
我被困在这里,我尝试过谷歌搜索,但找不到解决办法Php 无法重写MVC项目的url,php,apache,.htaccess,url-rewriting,Php,Apache,.htaccess,Url Rewriting,我被困在这里,我尝试过谷歌搜索,但找不到解决办法 Options +FollowSymLinks RewriteEngine On RewriteRule ^index\.php|style.css|img\.png$ - [L] # RewriteRule .* index.php [L] RewriteRule ^(.*)$ index.php?params=$1 [NC] 当我点击urlhttp://localhost/moviestock/home/indexprint
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^index\.php|style.css|img\.png$ - [L]
# RewriteRule .* index.php [L]
RewriteRule ^(.*)$ index.php?params=$1 [NC]
当我点击url
http://localhost/moviestock/home/index
print\r($\u-GET)
然后我得到了这个输出Array()
这意味着$\u-GET==Array()
但是我希望$\u-GET像这样$\u-GET==Array('controller'=>'home','action'=>'index'))
它类似于http://localhost/moviestock/index.php?controler=home&action=index
请给我任何解决方案在您的htaccess中尝试以下几行:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !\.(css|js|png)$
RewriteRule moviestock/([^/])+/([^/])+/?$ moviestock/index.php?controler=$1&action=$2