htaccess 404重定向问题
htaccess 401 重定向问题
我的问题是我的 404 重定向到我的 index.htm 文件不起作用。我可以让它工作的唯一方法是删除下面的 addtype 应用程序行,但我需要它来包含网站上的左侧导航。任何帮助都会非常感谢。
ErrorDocument 404 /
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$
RewriteRule .* products/noimage.jpg [L]
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^cases.com [NC]
RewriteRule ^(.*)$ http://www.cases.com/$1 [L,R=301]
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
# Rewrite Rule for blog.cases.com
RewriteCond %{HTTP_HOST} blog.cases.com$
RewriteCond %{REQUEST_URI} !blog/
RewriteRule ^(.*)$ blog/$1
AddType application/x-httpd-php .html .php .htm
htaccess 401 redirect problem
My problem is that my 404 redirect to my index.htm file is not working. The only way I can get it to work is by removing the addtype application line below, but I need this for an included left navigation on the site. Any help would be great thank you.
ErrorDocument 404 /
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$
RewriteRule .* products/noimage.jpg [L]
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^cases.com [NC]
RewriteRule ^(.*)$ http://www.cases.com/$1 [L,R=301]
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
# Rewrite Rule for blog.cases.com
RewriteCond %{HTTP_HOST} blog.cases.com$
RewriteCond %{REQUEST_URI} !blog/
RewriteRule ^(.*)$ blog/$1
AddType application/x-httpd-php .html .php .htm
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定,但其他一些人使用 AddType 时遇到了一些冲突。下面添加了一些似乎对人们有用的变体。在尝试更改 AddType 之前,请将完整的文件名放入 404 重定向中。
编辑:
我刚刚尝试了您的文件,但无法重现您的问题。我查看了您的托管公司的文档,您的说法是正确的。我看到他们提到的一件事是多个扩展,并且然后带您到一个显示您所说不起作用的代码(如下)的地方
他们确实在文档中显示了列出的完整域,并特别提到“.html 文件的文件名”,如下所示。
来源:http://support.verio.com/documents/view_article.cfm?doc_id =3624
如果这些不起作用,则可能是您的托管公司的问题。从那以后对我来说并没有多大用处,即使我尝试复制,也无法复制。对不起...
I am not sure but some others had some conflicts using the AddType. Some variations that seemed to work for people are added below. Before trying and changing the AddType, put the complete file name in the 404 redirect.
EDIT:
I just tried your file, and I can't reproduce your issue. I looked at your hosting company's docs and you have it correct. The one thing I do see them mention is multiple extensions, and then takes you to a place showing the code (below) which you said didn't work
They do show in the documentation the full domain listed and specifically mention "filename of the .html file" as shown below.
Source: http://support.verio.com/documents/view_article.cfm?doc_id=3624
If those don't work, then it probably is something with your hosting company. doesn't make to much since to me, and even if I tried to reproduce, couldn't. Sorry...