如何设置友好的 URL
我正在寻求您关于实现友好 URL 的最佳方式的建议。
我目前所做的是将所有 404 请求重定向到 index.php 中不存在的文件夹或文件。 index.php 读取查询字符串并进行数据库调用以查看该 url 是否在 page_urls 表中,然后根据页面类型获取内容等。
.htaccess 包含以下几行:
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php [L]
有没有更“聪明”的“请问如何做到这一点?谢谢。
谢谢。
I am looking for your recommandations on what would be the best way to implement friendly URLs.
What I currently do is redirect all 404 requests to folders or files that do not exist to index.php.
index.php reads the query string and makes a database call to see if the url is in the page_urls table then based on the page type fetches content etc etc.
The .htaccess contains the following lines:
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php [L]
Is there a more "clever" way of doing this please? Thank you.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现的最好的方法是执行如下操作:
The best way I've found is to do something like the following: