如何通过htaccess在URL中添加index.php [英] how to add index.php in the URL through htaccess
本文介绍了如何通过htaccess在URL中添加index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
实际上我需要通过 htaccess 文件在我的应用程序 URL 中添加 index.php.
Actually I need to add index.php in my application URL through htaccess file.
我的网址是这样的.
http://localhost:8080/myapp/xyz/abs.html
我需要把它改成.
http://localhost:8080/myapp/index.php/xyz/abs.html
谁能告诉我我需要在 htaccess 文件中写什么.
Can anyone tell me what i need to be write in htaccess file.
任何帮助都会受到赞赏.
Any Help will be appreciating.
谢谢.
推荐答案
在/myapp/.htaccess
中有这个规则:
RewriteEngine On
RewriteBase /myapp/
# If the request is not for a valid directory
RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.+) index.php/$1 [L]
这篇关于如何通过htaccess在URL中添加index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文