2013-07-13 165 views
0

我有一個與Debian服務器上的文件夾鏈接的域(與Apache)有問題。
(我會用domain.com我的服務器託管的文件的鏈接,併爲newdomain.com我要鏈接到它的域名。)

域忽略.htaccess?

事實

該網站是由html的的頁面。我在www.domain.com/subfolder/的這個.htaccess中刪除了'.html'。 subfolder-文件夾是我在我的服務器上託管網站的位置。 這適用於例如www.domain.com/subfolder/photos

RewriteEngine on 

    #example.com/page will display the contents of example.com/page.html 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME}.html -f 
    RewriteRule ^(.+)$ $1.html [L,QSA] 

    #301 from example.com/page.html to example.com/page 
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/ 
    RewriteRule ^(.*)\.html$ /$1 [R=301,L] 


我買了.BE域名是在www.domain.com/subfolder/主辦的網站,讓我們把它newdomain.be
我用虛擬主機將它連接到服務器並編輯了A記錄。 (並重裝了Apache,..)

<virtualhost *:80> 

     # Admin email, Server Name (domain name) and any aliases 
     ServerAdmin [email protected] 
     ServerName newdomain.be 
     ServerAlias www.newdomain.be 


     # Index file and Document Root (where the public files are located) 
     DirectoryIndex index.html 
     DocumentRoot /var/www/subfolder 

    </virtualhost> 


問題

的DNS的設置都還好,www.newdomain.be作品,並顯示從我domain.com/subfolder/中的index.html。
但是,www.newdomain.be/photos會拋出404!請注意,www.newdomain.be/photos.html按預期工作,所以問題必須在重寫我猜...
有人可以請解釋我在做什麼錯?

+0

當我插入的.htaccess文件錯誤,domain.com/subfolder拋出一個錯誤,但newdomain.be仍然有效。所以很顯然,newdomain.be忽略.htaccess ... –

回答

1

好的傢伙,我終於能夠解決它!

顯然將在虛擬主機的幾個額外的線路的伎倆:-)

DocumentRoot /var/www/subfolder 
<Directory /var/www/subfolder> 
    Options Indexes FollowSymLinks MultiViews 
    AllowOverride All 
    Order allow,deny 
    allow from all 
</Directory> 
0

你檢查了新文件夾的文件權限嗎?

爲/ var/WWW /子目錄嘗試搭配chmod -R命令/

+0

文件權限看起來正確,文件夾和.htaccess文件都設置爲R(eadable)給所有人... –