我有一些麻烦与国防部重写规则,并希望有人能够帮助...
我有一些类似example.com/o/overview/?did=10
的url,我已经添加了一个重写规则到我的htaccess,将url重写为example.com/o/overview/10.php
,但是我不希望.php出现在结尾,这就是我遇到麻烦的地方。
我已经尝试添加另一个重写规则,删除文件扩展名(.php或.html),但似乎不工作。任何帮助或指导将不胜感激。下面是htaccess:
# Remove file extensions from url
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^o/overview/([^/]*)\.php$ /o/overview/?did=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.html -f
RewriteRule ^(.+?)/?$ /$1.html [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [R=301,L]
1条答案
按热度按时间wfauudbj1#
使用显示示例,请尝试以下.htaccess规则文件
请确保:
o
文件夹放在沿着(不是放在里面,而是放在旁边)。/o/overview
文件夹中。