再也无法转到网站的根目录了

时间:2014-02-02 13:11:18

标签: php regex apache .htaccess mod-rewrite

我正在建立一个新的网站并且在使用htaccess之前有很多帮助,以使其全部工作。然而,我无法再访问网站www.placewomen.com的根源了...当我看到root的index.html时,它正在寻找/ c / c ....我的htaccess看起来像这样:

Options +FollowSymLinks -MultiViews -Indexes

RewriteEngine on

RewriteCond %{HTTP_HOST} ^placewomen.com [NC]

RewriteRule ^(.*)$ http://www.placewomen.com/$1 [R=301,L]

RewriteCond %{THE_REQUEST} \s/+new/index\.php\?var=([^\s&]+) [NC]

RewriteRule ^ /%1? [R=301,L]

RewriteCond %{DOCUMENT_ROOT}/c/$1 -f [OR]

RewriteCond %{DOCUMENT_ROOT}/c/$1 -d [OR]

RewriteCond %{DOCUMENT_ROOT}/c/$1 -l

RewriteRule ^(.*)$ /c/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.+)$ /new/index.php?var=$1 [QSA,L]

RewriteCond %{REQUEST_FILENAME} -d

RewriteCond %{REQUEST_FILENAME}/placeholder.jpg -f

RewriteRule ^(.*)$ /$1/placeholder.jpg [L]

1 个答案:

答案 0 :(得分:0)

试试这段代码:

Options +FollowSymLinks -MultiViews -Indexes
RewriteEngine on

RewriteCond %{HTTP_HOST} ^placewomen\.com$ [NC]
RewriteRule ^(.*)$ http://www.placewomen.com/$1 [R=301,L]

RewriteCond %{THE_REQUEST} \s/+new/index\.php\?var=([^\s&]+) [NC]
RewriteRule ^ /%1? [R=301,L]

RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME}/placeholder.jpg -f
RewriteRule ^(.*)$ /$1/placeholder.jpg [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteCond %{DOCUMENT_ROOT}/c/$1 -f [OR]
RewriteCond %{DOCUMENT_ROOT}/c/$1 -d [OR]
RewriteCond %{DOCUMENT_ROOT}/c/$1 -l
RewriteRule ^(.+)$ /c/$1 [L]

RewriteRule ^(.+)$ /new/index.php?var=$1 [QSA,L]