我想使用 .htaccess 将 url 重写到我的网站:
如果 url 是 http://mydomain.com或 http://mydomain.com/ index.html 将处理请求,所有其他 url 将转到 index.php
请帮忙!
最佳答案
像这样的东西会在内部将任何没有路径或只有尾部斜杠的请求重定向到 index.html,并将其他所有内容重定向到 index.php,并将路径作为参数。
RewriteEngine on
RewriteRule ^$ index.html
RewriteRule ^(.*)$ index.php?$1 [L]
关于php - .htaccess 重写/到 index.html,所有其他到 index.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16631861/