干净的“像推特一样”使用 codeigniter 的 url
您好,我正在构建一个网站,需要人们能够使用 urkl 访问该网页,例如 www.example.com/username ,我能够使用路由(:any)功能实现解决方案,但我遇到了两个问题::: 1.我必须实现网站上所有页面的路由。 2.用户头像不再显示,因为我通常使用控制器中的函数调用图像,而不是通过目录路径直接指向图像,
所以我想知道是否有办法使用 .htaccess 文件来解决这个问题同时消除过程中的index.php...谢谢
hello am building a site and would need people to be able to access there webpages using a urkl such as www.example.com/username , i was able to implement a solution using the route (:any) feature ,but i encountered two problems :::
1.i have to implement the route to all the pages on the website.
2.user avatars where no longer showing because instead of pointing to the images directly by following the directory path i usually call the images with a function in the controller
so i was wondering if there was a way to go about this using a .htaccess file while eliminating index.php in the proccess ... thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要查看 mod_rewrite (适用于您的网络服务器;例如 Apache)。该模块可以将漂亮的网址重写到您的网站结构中,从而呈现漂亮的网址并使您的网站表现正常。
You need to take a look at mod_rewrite (for your webserver; like Apache). This module can rewrite pretty url's to your website structure, thus presenting nice url's and have your site behave normal.
ShiVik 发布了一个非常全面的答案这里。我正准备尝试一下
ShiVik posted a pretty thorough answer here. I'm about try it out.