【发布时间】:2021-06-30 16:42:21
【问题描述】:
原始网址是以下之一:
example.comexample.com/index.phpexample.com/index.php?c=lorem
如果example.com - 什么都不应该做
如果example.com/index.php - 它应该以example.com 可见,这是我的代码 - 工作正常:
RewriteEngine ON
RewriteRule ^index\.php/?$ https://%{HTTP_HOST}/ [NC,R=301]
RewriteRule ^/?$ index.php [L]
如果example.com/index.php?c=lorem 它应该显示为example.com/lorem
和lorem 在这两种情况下都应该可以被php访问:
- 如果用户键入
example.com/index.php?c=lorem或 - 用户类型
example.com/lorem
请帮忙
【问题讨论】:
标签: apache .htaccess mod-rewrite url-rewriting friendly-url