我最近搬走了託管服務器,但是我在目錄中做了一些小改動。我將文件夾從「列表」更名爲「供應商」。我使用下面的代碼來防止404錯誤。無法用.htaccess重寫文件夾
RewriteEngine On
RewriteRule ^listing/(.*) vendors/$1
這並沒有爲我工作。我能做些什麼來解決這個問題?
舊網址:
http://www.oldsite.com/curacao/listing/chinese-culture-club/
新網址:
http://www.newsite.com/curacao/vendors/chinese-culture-club/
這是一個完整的.htaccess
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule^- [L]
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule . index.php [L]
RewriteRule ^listing/(.*) vendors/$1
# BEGIN WPSuperCache
# END WPSuperCache
# BEGIN WordPress
# END WordPress
在哪個目錄下是.htaccess? – arco444
最有可能的解釋'.htaccess'尚未啓用。 – arkascha
@ arco444在根 –