我在localhost上工作,以及免费托管服务我测试的东西,但在godaddy上它不会工作!
在我的根目录中,我有一个名为blog
的文件夹,里面有一个名为article.php
的文件
我的htaccess应该改写
http://www.bragdeal.com/blog/article.php?id=9 到http://www.bragdeal.com/blog/article/9
和
http://www.bragdeal.com/blog/index.php?page=2 到http://www.bragdeal.com/blog/page/2
Options -Indexes -MultiViews +FollowSymlinks
RewriteEngine On
RewriteBase /
AddDefaultCharset utf-8
SetEnv SERVER_ADMIN support@bragdeal.com
FileETag none
#force HTTP
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#article id
RewriteCond %{THE_REQUEST} /blog/article\.php\?id=([^\s&]+) [NC]
RewriteRule ^ blog/article/%1? [R=302,L]
RewriteRule ^blog/article/([^/.]+)/?$ blog/article.php?id=$1 [L,QSA,NC]
#page number
RewriteCond %{THE_REQUEST} /blog/index\.php\?page=([^\s&]+) [NC]
RewriteRule ^ blog/page/%1? [R=302,L]
RewriteRule ^blog/page/([^/.]+)/?$ blog/index.php?page=$1 [L,QSA,NC]
#------------------ remove index.php ---------------------------------
RewriteCond %{THE_REQUEST} /(?:index)?(.*?)\.php[\s?] [NC]
RewriteRule ^ %1 [R=302,L,NE]
# remove /index
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)index($|\ |\?)
RewriteRule ^ /%1 [R,L]
#-------------------remove .php-----------------------------------------
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI}\.php -f [NC]
RewriteRule ^(.+?)/?$ $1.php [L]
为什么它不适用于godaddy的托管?我将我的所有文件从localhost复制到godaddy,希望它是相同的