我对htacess有点麻烦。目前我在根目录中有htacess-
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^.*$ ./index.php
因此,无论使用什么URL,它都直接击中根目录中的index.php。
现在,我有一个名为“ test”的文件夹。
目前,当我键入http://example.com/test/时,它将在http://example.com/index.php上命中,但是我想在何时单击http://example.com/test/时,它将命中http。 ://example.com/test/index.php而不是根目录。
这意味着当仅在URL上使用/ test /时,我尝试了几种解决方案,但均无效果!
在我的本地主机中,我将根htacess放置在“ test”文件夹中,并且它可以工作,但不能在服务器中工作。
请帮助并提前致谢。
自己找到解决方案:D
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^test/ test/index.php [L,NC]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^ /index.php [L]
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句