【问题标题】:Remove trailing slash from url using htaccess使用 htaccess 从 url 中删除尾部斜杠
【发布时间】:2018-10-09 13:30:40
【问题描述】:

我有以下重写条件,它工作正常:

RewriteEngine on
RewriteRule ^([a-z0-9_-]+)\.html$ index.php/page/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|asset|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

但是,只需在我的网址中添加一个尾随反斜杠,网站就会中断。我看过几个类似的问题和答案,但对我没有用,主要是因为我不熟悉 htaccess。

如何让我的网址自动更改

http://localhost:8888/mysite/mylink/

http://localhost:8888/mysite/mylink

我正在使用 codeigniter,我的应用程序仍在本地主机中。感谢这方面的任何帮助。谢谢。

【问题讨论】:

标签: .htaccess codeigniter


【解决方案1】:

只需更改所有链接,不要在末尾添加斜线即可。

【讨论】:

    猜你喜欢
    • 2015-05-09
    • 2021-12-14
    • 2014-07-20
    • 2022-01-23
    • 2015-01-15
    • 1970-01-01
    相关资源
    最近更新 更多