2011-02-04 69 views
0

我得到了一些的RewriteRules它在文件夾中的工作主要 內,例如:主文件夾/ 我把htaccess的內/的.htaccess重寫規則工作在子文件夾,但不是在主

這是。 htaccess

Options +FollowSymlinks 
RewriteBase/
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^about/(.*)/$ $1.php [L] 
RewriteRule ^(.*)/download/(.*)/(.*)/(.*)/$ download-donate.php?product=$1&version=$2&os=$3&method=$4 [L] 
RewriteRule ^(.*)/download/(.*)/$ download.php?product=$1&version=$2 [L] 
RewriteRule ^subscribe/(.*)/$ subscribe-$1.php [L] 
RewriteRule ^subscribe/(.*)/(.*)/$ subscribe-$1.php?email=$2 [L] 
RewriteRule ^(.*)/screenshots/$ screenshots.php?product=$1 [L] 
RewriteRule ^(.*)/(.*)/$ products.php?product=$1&page=$2 [L] 
RewriteRule ^schedule-manager/$ products.php?product=schedule-manager&page=view [L] 
RewriteRule ^visual-command-line/$ products.php?product=visual-command-line&page=view [L] 
RewriteRule ^windows-hider/$ products.php?product=windows-hider&page=view [L] 
RewriteRule ^(.*)/$ $1.php [L] 

它不能在主文件夾中工作。 如果我把相同的htaccess(將RewriteBase更改爲/ test /),並將其放入名爲「test」>/test /的文件夾中,它可以完美地工作 - 主文件夾和測試文件夾都完全相同!

感謝

+0

上面,你可以在你擁有了一切指向.COM /東西會被rewrited辦法破解它以.com /測試/東西..不是一個正確的答案,但如果你缺乏其他選擇,它可以爲你工作。 – yoda 2011-02-04 00:29:12

+0

問題是 - 子文件夾DID WORK <<主文件夾DID NOT WORK .. – Ron 2011-02-04 00:33:05

回答

2

如果您的託管公司GoDaddy的,加

Options -MultiViews 

Options +FollowSymlinks 
0

嘗試改變這兩個參數的順序:

RewriteEngine On 
RewriteBase/

不知道它會做什麼,但它更有意義這種方式。

編輯

這裏假設你有你的代碼在/測試/文件夾。

Options +FollowSymlinks 
RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^about/(.*)/$ test/$1.php [L] 
RewriteRule ^(.*)/download/(.*)/(.*)/(.*)/$ test/download-donate.php?product=$1&version=$2&os=$3&method=$4 [L] 
RewriteRule ^(.*)/download/(.*)/$ test/download.php?product=$1&version=$2 [L] 
RewriteRule ^subscribe/(.*)/$ test/subscribe-$1.php [L] 
RewriteRule ^subscribe/(.*)/(.*)/$ test/subscribe-$1.php?email=$2 [L] 
RewriteRule ^(.*)/screenshots/$ test/screenshots.php?product=$1 [L] 
RewriteRule ^(.*)/(.*)/$ test/products.php?product=$1&page=$2 [L] 
RewriteRule ^schedule-manager/$ test/products.php?product=schedule-manager&page=view [L] 
RewriteRule ^visual-command-line/$ test/products.php?product=visual-command-line&page=view [L] 
RewriteRule ^windows-hider/$ test/products.php?product=windows-hider&page=view [L] 
RewriteRule ^(.*)/$ test/$1.php [L] 
+0

之前嘗試過。沒有工作。並與我的訂單它在子文件夾中工作,所以沒有理由更改訂單 – Ron 2011-02-04 00:32:26