我在我的 htaccess 文件中进行了重写,从 url 中删除了 index.php
RewriteEngine on
RewriteCond $1 !^(images|media|system|themes|_css|_js|favicon\.ico|robots\.txt|cert\.html|index\.php) [NC]
RewriteRule ^(.*)$ /index.php/$1 [L]
除此之外,我想对任何没有的请求强制使用www
and 。https
所以最终所有的网址应该是这样的https://www.example.com/whatever/something/
:并且出于 SEO 的目的,如果 url 错过了标记,它应该 301 重定向到它的正确版本,例如:
http://example.com/about/
301 redirect to
https://www.example.com/about/
希望有人帮助实现这一点,谢谢!