我在Ubuntu 14.04上运行LAMP服务器,一切似乎都配置正常。 唯一的问题是,重写规则以某种方式被忽略而不发出任何错误。 修改.htaccess文件后,页面会像往常一样重新加载。 我想要做的是使用以下代码将所有流量路由到index.php:
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php [L]其他规则运作正常,例如。 如果我deny from all添加deny from all并重新加载页面,我立即得到错误。 所有文件和文件夹都位于/ var / www / root目录中。 我不知道这里缺少什么,我花了几个小时调试这个问题没有解决方案:(。
谢谢
I have LAMP server running on Ubuntu 14.04, and everything seems to be configured fine. The Only problem that am having is that, the rewrite rule is somehow getting ignored without issuing any error. The page reloads again as usual after modifying the .htaccess file. What I am trying to do, is to route all traffic to index.php using the following code:
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php [L]Other rules are functioning properly, eg. if I add deny from all and reload the page,I immediately get en error. All files and folders are located in the /var/www/ root directory. I don't know what am missing here, I spent hours debugging this issue without a solution :(.
最满意答案
这个. 只会匹配一个字符。 尝试使用.*来匹配任何东西。
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule .* index.php [L]I found a solution to redirect all traffic to index.php by pointing the document root to index.php:
<VirtualHost *:80> ServerAdmin admin@example.com ServerName example.com ServerAlias www.example.com DocumentRoot /var/www/example.com/index.php </VirtualHost>thanks @Chris for the help.
更多推荐
index,php,The,问题,电脑培训,计算机培训,IT培训"/> <meta name="description&
发布评论