2
出於測試的目的着想的.htaccess清潔網址我已成立的index.php其中只包含:PHP - 不工作
<?php echo var_dump($_GET); ?>
我htaccess的是這樣的:
RewriteEngine on
#Alternate default index page
DirectoryIndex home.php
# To set your custom php.ini, add the following line to this file:
# suphp_configpath /home/yourusername/path/to/php.ini
# php_value mbstring.func_overload 4 # Required for PWSB support. Please do not uncomment this line.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [L]
RewriteBase/
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^motionpicturepicker\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.motionpicturepicker\.com$
RewriteRule ^/?$ "http\:\/\/furff\.com" [R=301,L]
這太我的知識刪除.php和.html擴展以及www。
現在我已經嘗試過幾乎所有乾淨網址的谷歌示例(約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=whatever
重定向到/index/whatever
然而/index/whatever
回報的Error 500 - Internal Server Error
而不是index.php文件。 但是,如果我手動將url更改爲index.php/whatever
它確實有效,但會返回一個空數組。
那麼我怎麼能得到乾淨的網址加載頁面和乾淨的字符串查詢工作以及?
運行完美的感謝!我有什麼問題?命令? – Greg
這主要是你的規則訂購,導致你的問題。 – anubhava