gpt4 book ai didi

php - 从网址中删除 .html

转载 作者:搜寻专家 更新时间:2023-10-31 21:27:13 26 4
gpt4 key购买 nike

我想从站点的所有 url 中删除 .html,我正在使用 x-cart 并希望使用 .htaccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
</IfModule>

我使用了这段代码,但它不起作用

最佳答案

像这样使用:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)/?$ $1.html [NC,L]

关于php - 从网址中删除 .html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34313593/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com