[英]Removing file extensions in .htaccess with wordpress
我有一個與wordpress一起在同一目錄中運行的靜態網站,一切正常。 但是,在不使用wordpress的靜態頁面上,我似乎無法刪除.php文件擴展名,我的.htaccess文件如下所示:
# BEGIN WordPress
<IfModule mod_rewrite.c>
ErrorDocument 404 /index2.php
RewriteEngine On
RewriteBase /index.php/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
#Alternate default index page
DirectoryIndex index2.php
ErrorDocument 404 http://example.com/index2.php
我已經嘗試像平時一樣添加此代碼,但無法正常工作:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
嘗試這個
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.