【问题标题】:.htaccess produce 404 page not found in IE.htaccess 产生 404 页面在 IE 中找不到
【发布时间】:2016-07-01 04:37:43
【问题描述】:

我正在开发 Typo3 版本 4.7.4。当我可以在除 IE 之外的每个浏览器(所有版本)中访问站点的前端时。将自定义的 .htaccess 文件替换为 Typo3 版本 4.7.4 的默认 .htaccess 后,它工作正常。然后我比较了两个文件,除了一些配置之外,我找不到不同的东西。但是,我不确定这些新配置是否杀死了 IE。这是我的新 .htaccess 配置:

#####################################
###     Compression via TYPO3     ###
#####################################
<FilesMatch "\.js\.gzip$">
    AddType "text/javascript" .gzip
</FilesMatch>
<FilesMatch "\.css\.gzip$">
    AddType "text/css" .gzip
</FilesMatch>
AddEncoding gzip .gzip

##################################################
###     Browser caching of resource files     ###
##################################################
<FilesMatch "\.(js|css)$">
  <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault "access plus 7 days"
  </IfModule>
  FileETag MTime Size
</FilesMatch>

########################################
###     Settings for mod_rewrite     ###
########################################
<IfModule mod_rewrite.c>
RewriteEngine On

### Change this path, if your TYPO3 installation is located in a subdirectory of the website root.
#RewriteBase /

### IMPORTANT: This rule has to be the very first RewriteCond in order to work!
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]

RewriteRule ^fileadmin/(.*/)?_recycler_/ - [F]
RewriteRule ^fileadmin/templates/.*(\.txt|\.ts)$ - [F]
RewriteRule ^typo3conf/ext/[^/]+/Resources/Private/ - [F]

#RewriteRule ^(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
RewriteRule ^typo3$ typo3/index_re.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule .* index.php [L]

############################################################################
###     Redirect all users directly to the https version of the page     ###
############################################################################

RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]
RewriteRule ^(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
RewriteRule ^typo3$ typo3/index_re.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule .* index.php [L]

</IfModule>

#############################
###     Miscellaneous     ###
#############################
Options -Indexes

########################################################
###     Disable *.ts files viewing from Frontend     ###
########################################################
<FilesMatch "\.(ts)$">
 order deny,allow
 deny from all
</FilesMatch>

任何想法将不胜感激。 谢谢

【问题讨论】:

  • 请检查您的代码:“将所有用户直接重定向到页面的 https 版本”没有重定向。 "RewriteRule .* index.php [L]" 定义了两次。
  • 这很重要。我注释掉上面的行并且它有效。但是我遇到了另一个问题。它打破了我的 PIE.htc 行为。感谢 maholtz 的帮助。
  • 请在此处更新您的代码。并注释掉“RewriteCond”,你总是有一些 RewriteCond 后跟 RewriteRule。如果指向 PIE.htc 的 url 正确,请检查 pie.htc 和 PIE.htc 之间的区别。
  • 嗯,我找到了。我将它复制到 css/ 目录,它可以工作。

标签: .htaccess redirect http-status-code-404 typo3


【解决方案1】:

感谢马霍兹的帮助。

#####################################
###     Compression via TYPO3     ###
#####################################
<FilesMatch "\.js\.gzip$">
    AddType "text/javascript" .gzip
</FilesMatch>
<FilesMatch "\.css\.gzip$">
    AddType "text/css" .gzip
</FilesMatch>
AddEncoding gzip .gzip

##################################################
###     Browser caching of resource files     ###
##################################################
<FilesMatch "\.(js|css)$">
  <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault "access plus 7 days"
  </IfModule>
  FileETag MTime Size
</FilesMatch>

########################################
###     Settings for mod_rewrite     ###
########################################
<IfModule mod_rewrite.c>
RewriteEngine On

### Change this path, if your TYPO3 installation is located in a subdirectory of the website root.
#RewriteBase /

### IMPORTANT: This rule has to be the very first RewriteCond in order to work!
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]

RewriteRule ^fileadmin/(.*/)?_recycler_/ - [F]
RewriteRule ^fileadmin/templates/.*(\.txt|\.ts)$ - [F]
RewriteRule ^typo3conf/ext/[^/]+/Resources/Private/ - [F]

#RewriteRule ^(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
RewriteRule ^typo3$ typo3/index_re.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

# RewriteRule .* index.php [L]

############################################################################
###     Redirect all users directly to the https version of the page     ###
############################################################################

RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]
RewriteRule ^(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
RewriteRule ^typo3$ typo3/index_re.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule .* index.php [L]

</IfModule>

#############################
###     Miscellaneous     ###
#############################
Options -Indexes

########################################################
###     Disable *.ts files viewing from Frontend     ###
########################################################
<FilesMatch "\.(ts)$">
 order deny,allow
 deny from all
</FilesMatch>

请注意,错误在这里# RewriteRule .* index.php [L]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-19
    • 1970-01-01
    • 2018-05-13
    • 1970-01-01
    • 1970-01-01
    • 2013-06-28
    • 2020-02-22
    • 1970-01-01
    相关资源
    最近更新 更多