- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 .htaccess 文件,如下所示,但出现错误Invalid command 'RedirectMatch', perhaps misspelled or defined by a module not included in the server configuration
.我已经做了很多搜索,但找不到问题所在,mod rewrite 已加载并且似乎可以正常工作。
我在 Ubuntu 14.04 上运行 Apache 2.4.7。
任何帮助或指导都会很棒。
# rewrite rules
<IfModule mod_rewrite.c>
# enable awesome urls. i.e.:
# http://yourdomain.com/about-us/team
RewriteEngine on
# make sure to set the RewriteBase correctly
# if you are running the site in a subfolder.
# Otherwise links or the entire site will break.
#
# If your homepage is http://yourdomain.com/mysite
# Set the RewriteBase to:
#
# RewriteBase /mysite
#
RewriteBase /
# force www on domain
# RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
# RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
# block text files in the content folder from being accessed directly
RewriteRule ^content/(.*)\.(txt|md|mdown)$ error [R=301,L]
# block all files in the site folder from being accessed directly
RewriteRule ^site/(.*) error [R=301,L]
# block all files in the kirby folder from being accessed directly
RewriteRule ^kirby/(.*) error [R=301,L]
# leave robots.txt alone for search engines
RewriteRule ^robots.txt robots.txt [L]
# redirect /cashback to home
RedirectMatch 301 ^/cashback/?$ http://www.example.com/
# add trailing slash to links
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
# make panel links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^panel/(.*) panel/index.php [L]
# make site links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]
</IfModule>
最佳答案
mod rewrite is loaded and seemingly working otherwise.
RedirectMatch 301 ^/cashback/?$ http://www.example.com/
RedirectMatch
是 mod_alias 的一部分,而不是 mod_rewrite。虽然 mod_alias 通常默认加载,除非它已被明确删除?
RewriteRule
)重新处理此重定向。像这样:
RewriteRule ^cashback/?$ / [R=301,L]
关于apache - 无效命令 'RedirectMatch' - Apache 2.47。 Ubuntu 信任,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34755923/
我在我的网站中移动了许多网址:/folder/page.php至:/folder/page/ . 现在我想将旧网址重定向到新网址,所以我添加了 .htaccess这条规则: RedirectMatch
我是这个社区的新手,但听说过很多。所以,我今天来这里是为了解决我关于重定向 301 和重定向匹配 301 的一个问题。 我曾尝试使用类似的重定向 301 来重定向 404 页面 Redirect 30
我试图将每个没有 # 的 URL 重定向到相同的,但在 /path/ 之后带有 #。 例子: 此网址:https://www.example.com/path/test/test 需要重定向到这个 u
在我们的网站上,用户可以上传图片。对于每张图片,我们在数据库中创建一行,其中包含 2 个字段:id 和 32 个字符的唯一代码。我们在数据库中有大约 200.000 张图片,每张图片都保存在某个文件夹
我正在尝试编写一个规则,其中只有在没有任何参数的情况下调用 URL 时才会发生重定向,因此例如这将重定向: domain.com/a/b/ 但这不会,它会顺利通过,加载这个特定的 URL: domai
我一直在读,在可能的情况下,我不应该使用 mod_rewrite .因此,我正在尝试使用 RedirectMatch 进行 http 到 https 重写。 问题:我如何使用 RedirectMatc
我目前正在开发一个应用程序,该应用程序在公共(public)网络根目录下有很多目录,这些目录不应公开访问。目前,这是通过在所有不应浏览的目录中放置大量具有 Deny from All 规则的 .hta
我正在尝试将对/library/的所有请求重定向到外部 URL,除非请求 .pdf 文件。例如www.mysite.com/library/section 应重定向至 www.externalsite
需要一些帮助来添加 最后或 L 与 RedirectMatch 上的 301 一起标记。 我正在使用的代码如下所示,但只有 301 地位 RedirectMatch 301 ^/(folder1|fo
在根目录或我客户的服务器 (www.thesite.com) 上,在一堆文件夹和目录中,安装了一个有效的 expressionEngine 站点。 客户让我改用wordpress建立一个新网站。我做到
大家好。我开始编写自己的“URL 缩短器”。基本思路是使用 example.com/12345 重定向到另一个 URL。这种“匹配”是通过使用 .htaccess 将内容重定向到执行(现在与我们无关)
我有一个 .htaccess 文件,如下所示,但出现错误Invalid command 'RedirectMatch', perhaps misspelled or defined by a modu
我正在尝试使用 Traefik 设置前端重定向,但文档没有解释如何执行此操作。 我在 Apache 中有一个现有的 VirtualHost 配置,它通过以下方式执行此操作: ServerName ji
拜托,这让我很头疼! 我将旧站点 (goo.gl/onQ3UM) 重定向到新目录。我将旧站点的所有 URL 重定向到新主页(我现在意识到这是一个错误,因为我在上周初收到了很多 404 和软 404)。
我是一名优秀的程序员,十分优秀!