htaccess删除index.php并将www添加到expressionengine中的url

htaccess删除index.php并将www添加到expressionengine中的url,php,.htaccess,codeigniter,expressionengine,Php,.htaccess,Codeigniter,Expressionengine,我用expressionengine创建了一个网站,在htaccess中,我需要删除index.php并添加www-to-none-www-url。 以下是我当前的.htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # Add www to url RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http:

我用expressionengine创建了一个网站,在htaccess中,我需要删除index.php并添加www-to-none-www-url。 以下是我当前的.htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Add www to url
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

    # Directs all EE web requests through the site index file
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

    # Removes index.php from ExpressionEngine URLs
    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
    RewriteCond %{REQUEST_URI} !/system/.* [NC]
    RewriteRule (.*?)/index\.php/*(.*) /$1$2 [R=301,NE,L]

</IfModule>
出现index.php。我不知道该怎么办,任何帮助都会被感激的

试试这个

RewriteEngine On

#Redirect non-www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

它将从URL中删除
index.php
,并添加
www
作为前缀。

www重定向可能无法工作,因为没有通配符,请保持简单并指定您的域:

# Redirect to www
# -------------------
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
我希望您以错误的方式删除和添加index.php,如果在URL中指定,我将首先重定向它,然后将其添加到隐藏:

# Redirect specific index.php requests in URL
# ------------------------------
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]

# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
是否也尝试使用和不使用?在这一行中,根据服务器设置,可能不需要这样做:

RewriteRule ^(.*)$ index.php?/$1 [L,QSA]


实际上它是单独工作的,问题是当我想删除index.php并添加www@Ajay-在尝试了许多规则之后,这段代码终于对我起了作用。始终在这里提供帮助:)
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
RewriteRule ^(.*)$ index.php/$1 [L,QSA]