我的.htaccess
文件有問題。 我最近搬到那是在一個子目錄中的根路徑論壇(IPB),所以我寫了這個.htaccess
文件.htaccess移動論壇和SEO網址
Options +FollowSymLinks
RewriteEngine on
RewriteBase/
RewriteRule ^view/([0-9]+)/?$ index.php?view=$1 [NC,L]
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteCond %{REQUEST_URI} !^/forum/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /forum/$1
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteRule ^(/)?$ forum/index.php
而這個工作非常出色。 基本上,我想要指向論壇的舊網址,被重定向到論壇子目錄。
但這是問題所在。 在根路徑現在,有一個index.php文件,這將是新的網站,我想搜索引擎友好的URL,所以我寫了這條線
RewriteRule ^view/([0-9]+)/?$ index.php?view=$1 [NC,L]
但這種規則不起作用。 像
www.domain.com/view/welcome/
每個請求重定向到一個404頁的IPB論壇。
我也試過放一些RewriteCond,但結果是一樣的, 每個涉及根路徑中新index.php的url都會變成一個404頁面。
編輯: 在/論壇/ 有此.htaccess
ErrorDocument 401 /401.shtml
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /forum
RewriteCond %{REQUEST_FILENAME} .*\.(jpeg|jpg|gif|png)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /public/404.php [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L,QSA]
</IfModule>
還沒幹活G。我相信問題是我用來將請求重定向到/ forum /的規則,但我現在不能找到解決方案 – divby0
。我已經擴展了答案 – splash58
不,這不起作用。 – divby0