3
以下.htaccess不适用于根级页面。.httaccess文件不适用于主页
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^demo\-blog/(.*)$ demo\-blog/index.php/$1 [L]
如果我访问http://example.com/demo-blog/blog/publish.html那么它的工作原理是在http://example.com/demo-blog/index.php/blog/publish.html执行文件,但是当我访问http://example.com/demo-blog/它不会从http://example.com/demo-blog/index.php加载页面。 .htaccess文件位于域根目录下。 http://example.com/
请让我知道为什么它不重写主页的网址。
谢谢你,它的工作。我只评论了匹配如下目录。 #RewriteCond%{REQUEST_FILENAME}!-d我的匹配没有任何改变。 – Nishanthan
是的,它也可以和你的正则表达式一起工作,但是如果你输入的URL是这个'http:// example.com/demo-blog'(没有结尾的斜杠),那么它就不会。 – anubhava
+1为您的正则表达式。 –