1
每當我試圖用.htacess
隱藏.php
分機號碼並使用.php
分機號碼轉到一個頁面時,屏幕上顯示的所有內容都是「Page Not Found」。我以前完美的工作,但我最近更改了託管公司,現在我使用Plesk Onyx 17.0.17
與CentOS Linux 7.3.1611
和PHP 7.1.4
。.htaccess隱藏分機號碼
這裏是我的.htaccess
文件的內容:
Options -Multiviews -Indexes
# Disable Automatic Directory detection
DirectorySlash Off
ErrorDocument 404 /!404.php
RewriteEngine On
RewriteBase/
# Remove trailing slashes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/+$ $1 [R=301,L]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
是使用Apache或nginx的吧。如果它使用nginx,則此文件不執行任何操作。 –
@AndrewRayner'mod_rewrite'是一個'Apache'模塊 –
@PedroLobito正確,但他表示在切換主機時停止工作。這意味着,如果他以前使用Apache。這將工作。 –