2017-07-27 50 views
0

mydomain.pe Linux服務器與Apache上,我已經在的ErrorDocument 404找到/404.html沒有在.htaccess文件工作在APACHE

做一個假的URL然而,當添加以下行ErrorDocument 404 /404.html.htaccess RewriteEngine敘述下測試:默認情況下,abc.mydomain.pe/etc.html拋出404錯誤。

我404.html文件通過在URL中的網絡可見:abc.mydomain.pe/404.html

請你們的支持,我有時間,我一直沒能在我的身邊來解決它。

這可能發生?我分享我的.htaccess文件:

<IfModule mod_rewrite.c> 
RewriteEngine on 
ErrorDocument 404 /404.html 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}.html -f 
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ 
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ 
RewriteRule ^(.*)$ $1.html 

RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.abc.mydomain.pe/$1 [R,L] 

RewriteCond %{HTTP_HOST} !^www.abc.mydomain.pe$ [NC] 
RewriteRule ^(.*)$ https://www.abc.mydomain.pe/$1 [L,R=301] 

Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" 

RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* ? [F,L] 
Options -Indexes 
</IfModule> 


<IfModule mod_headers.c> 
<FilesMatch ".(js|css|xml|gz|html)$"> 
Header append Vary: Accept-Encoding 
</FilesMatch> 
</IfModule> 

<IfModule mod_deflate.c> 
    <filesMatch "\.(js|css|html|php)$"> 
     SetOutputFilter DEFLATE 
    </filesMatch> 
</IfModule> 

## EXPIRES CACHING ## 
<IfModule mod_expires.c> 
ExpiresActive On 
ExpiresByType image/jpg "access 1 year" 
ExpiresByType image/jpeg "access 1 year" 
ExpiresByType image/gif "access 1 year" 
ExpiresByType image/png "access 1 year" 
ExpiresByType text/css "access 1 month" 
ExpiresByType text/html "access 1 month" 
ExpiresByType application/pdf "access 1 month" 
ExpiresByType text/x-javascript "access 1 month" 
ExpiresByType application/x-shockwave-flash "access 1 month" 
ExpiresByType image/x-icon "access 1 year" 
ExpiresDefault "access 1 month" 
ExpiresByType text/javascript "access 1 month" 
</IfModule> 
## EXPIRES CACHING ## 

## INICIO compresión gzip (mod_deflate) 
<IfModule mod_deflate.c> 
AddOutputFilterByType DEFLATE text/plain 
AddOutputFilterByType DEFLATE text/html 
AddOutputFilterByType DEFLATE text/xml 
AddOutputFilterByType DEFLATE text/shtml 
AddOutputFilterByType DEFLATE text/css 
AddOutputFilterByType DEFLATE application/xml 
AddOutputFilterByType DEFLATE application/xhtml+xml 
AddOutputFilterByType DEFLATE application/rss+xml 
AddOutputFilterByType DEFLATE application/javascript 
AddOutputFilterByType DEFLATE application/x-javascript 
</IfModule> 
## FIN compresión gzip (mod_deflate)## 

# php -- BEGIN cPanel-generated handler, do not edit 
# Configure el paquete 「ea-php56」 como el lenguaje de programación predeterminado 「PHP」. 
<IfModule mime_module> 
    AddType application/x-httpd-ea-php56 .php .php5 .phtml 
</IfModule> 
# php -- END cPanel-generated handler, do not edit 

回答

0

如果您的域名是mydomain.pe那麼,你說這是在abc.mydomain.pe/404.html

您的錯誤文檔可能是放錯了地方

也許你應該將文件404.html複製到mydomain.pe/404.html,因爲Apache會在那裏尋找它。它應該可以通過mydomain.pe/404.html而不是通過abc.mydomain.pe/404.html訪問

+0

感謝您的及時響應,在使用該域名abc.mydomain.pe(子域),但我也有404.html在mydomain.pe,這通過URL可見,但在進行URL錯誤測試時不會加載。 我也曾想過 Regards, Axel P. –

0

我已經能夠解決它的cPanel面板使用「錯誤頁面」,好奇的東西,我注意到,一個創建了404.shtml文件(「s」添加),這對我來說是新東西,也許EasyApache 4現在也可以工作。

謝謝您的閱讀, 阿克塞爾P.