Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
表达式引擎使用.htaccess删除index.php无效_.htaccess_Mod Rewrite_Expressionengine - Fatal编程技术网

表达式引擎使用.htaccess删除index.php无效

表达式引擎使用.htaccess删除index.php无效,.htaccess,mod-rewrite,expressionengine,.htaccess,Mod Rewrite,Expressionengine,我的客户有一个godaddy虚拟专用服务器是的,我知道它很烂。。。。它有WHM VPS优化运行 我正试图从URL中删除index.php,但我的服务器仍然显示404个错误。我在世界上的每个论坛上都看到了这些错误,无法获得一个有效的htaccess文件。下面是表达式引擎告诉您使用的内容 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} !^(/index\.php|/img|

我的客户有一个godaddy虚拟专用服务器是的,我知道它很烂。。。。它有WHM VPS优化运行

我正试图从URL中删除index.php,但我的服务器仍然显示404个错误。我在世界上的每个论坛上都看到了这些错误,无法获得一个有效的htaccess文件。下面是表达式引擎告诉您使用的内容

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^(/index\.php|/img|/js|/css|/robots\.txt|/favicon\.ico)
    RewriteRule ^(.*)$ /index.php/$1 [L]
    </IfModule> 

我对阿帕奇一无所知。。请帮助kind sirs…

测试htaccess是否正常工作:

# Redirect domain
RewriteCond %{HTTP_HOST} ^www.yourdomain.com$
RewriteRule ^/?$ "http\:\/\/google\.com" [R=301,L]

确保在输入/index.php:p时确实显示了内容

一旦知道htaccess正在工作,请尝试$1而不是%{REQUEST_URI}:

RewriteEngine on
RewriteCond $1 !^(img|admin\.php|themes|robots\.txt|index\.php|sitemap\.xml|/favicon\.ico) [NC]
RewriteRule ^(.*)$ /index.php?/$1 [L]
也可以尝试/index.php?/$1而不是/index.php/$1

确保您已经设置了EE Admin->General Configuration,以便站点索引页的名称为空

记住,一旦你让EE在没有index.php出现的情况下工作,它可以在有和没有的情况下使用,这对SEO是有害的,所以在上面重写之前将其删除:

# Redirect index.php Requests (prevent site showing index.php in browser address bar)
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]

mod_rewrite实际启用了吗?使用peter在下面发布的内容,我认为这不是。。。我尝试使用您的资源并登录到根ssh,但命令sudo a2enmod rewrite提示a2enmod:command not found。。。就像我说的,我对ssh和apache知之甚少,只是想在这里获得一些非常seo友好的URL。服务器正在运行Apache2.2重定向域重写cond%{HTTP\u HOST}^www.yourdomain.com$RewriteRule^/?$HTTP\:\/\/google\.com[R=301,L]\uuuuuuuuuuuuuuuuuuuuuuu不工作,所以htaccess显然。。。啊。。。
# Redirect index.php Requests (prevent site showing index.php in browser address bar)
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]