PHP-.htaccess干净的URL不起作用

PHP-.htaccess干净的URL不起作用,php,html,apache,.htaccess,mod-rewrite,Php,Html,Apache,.htaccess,Mod Rewrite,出于测试目的,我设置了index.php,它只包含: <?php echo var_dump($_GET); ?> 据我所知,这也删除了.php和.html扩展名以及www 现在,我已经尝试了几乎每一个清洁url的谷歌提供的例子(大约20 ish),没有一个是完全正确的 加上这是我最近的一次: RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+index\.php\?film=([^\s&]+) [NC] RewriteRule ^ ind

出于测试目的,我设置了index.php,它只包含:

<?php echo var_dump($_GET); ?>
据我所知,这也删除了.php和.html扩展名以及www

现在,我已经尝试了几乎每一个清洁url的谷歌提供的例子(大约20 ish),没有一个是完全正确的

加上这是我最近的一次:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+index\.php\?film=([^\s&]+) [NC]

RewriteRule ^ index/%1? [R=301,L]
RewriteRule ^index/([^/]+)/?$ index.php?film=$1 [L,QSA]
这使得转到
index.php?film=which
重定向到
/index/which
但是
/index/whatever
返回的
错误500-内部服务器错误
而不是index.php。 但是,如果我手动将url更改为
index.php/which
,它会工作,但返回一个空数组

那么,如何才能获得干净的url来加载页面,并使干净的字符串查询也能正常工作呢?

尝试以下规则:

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www\.)?motionpicturepicker\.com$ [NC]
RewriteRule (.*) http://furff.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule (.*) http://%1/$1 [R=301,L]

RewriteCond %{THE_REQUEST} \s/+index\.php\?film=([^\s&]+) [NC]
RewriteRule ^ index/%1? [R=301,L]

RewriteRule ^index/([^/]+)/?$ index.php?film=$1 [NC,L,QSA]

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php [L]

RewriteCond %{REQUEST_FILENAME}\.html -f 
RewriteRule ^(.*)$ $1.html [L]

非常好,谢谢!我的问题是什么?顺序?主要是规则的顺序给你带来了问题。
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www\.)?motionpicturepicker\.com$ [NC]
RewriteRule (.*) http://furff.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule (.*) http://%1/$1 [R=301,L]

RewriteCond %{THE_REQUEST} \s/+index\.php\?film=([^\s&]+) [NC]
RewriteRule ^ index/%1? [R=301,L]

RewriteRule ^index/([^/]+)/?$ index.php?film=$1 [NC,L,QSA]

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php [L]

RewriteCond %{REQUEST_FILENAME}\.html -f 
RewriteRule ^(.*)$ $1.html [L]