【发布时间】:2015-10-16 18:14:08
【问题描述】:
@Starkeen,此代码对我不起作用。现在所有其他页面都有 404 错误,并且主页没有添加 www。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^sitename.com$
RewriteRule ^(.*)$ http://www.sitename.com/$1 [NC,R=301,L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#This last condition enables access to the images and css folders, and the robots.txt file
RewriteCond $1 !^(index\.php|public|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [R=301,L]
</IfModule>
请帮忙
【问题讨论】:
-
@Starkeen,这就是我所拥有的。好像有点长吧?
-
@Starkeen 保存了它,但没有添加 www,所有其他页面都出现 404 错误,帮助伙伴!非常感谢