Apache-.htaccess-仅重定向以“.”结尾的URL/饲料“;

Apache-.htaccess-仅重定向以“.”结尾的URL/饲料“;,apache,.htaccess,url-redirection,Apache,.htaccess,Url Redirection,我只想重定向以/feed结尾的url(常量404s-来自Amazon服务器?-使用错误的url)。如何配置重定向 当前我的.htaccess文件如下所示。我正在尝试在传入url之前添加文件夹/类别 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / Redirect 301 /mobile-home / Redirect 301 /destinations-3/greeter-destinations/ /greeter-d

我只想重定向以
/feed
结尾的url(常量404s-来自Amazon服务器?-使用错误的url)。如何配置重定向

当前我的.htaccess文件如下所示。我正在尝试在传入url之前添加文件夹/类别

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Redirect 301 /mobile-home /
Redirect 301 /destinations-3/greeter-destinations/ /greeter-destinations/
Redirect 301 /destinations-3/ /category/destinations/
RewriteRule ^index\.php$ - [L]
#RewriteCond %{REQUEST_URI} !^/content/
#RewriteRule ^(.*)/feed$ content/category/$1/feed [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

重新启动发动机
重写基/
重定向301/移动家庭/
重定向301/目的地-3/迎宾目的地//迎宾目的地/
重定向301/目的地-3//类别/目的地/
重写规则^index\.php$-[L]
#重写cond%{REQUEST_URI}^/内容/
#重写规则^(.*)/feed$content/category/$1/feed[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
2“#”行取自另一个线程,但它们没有任何效果


感谢您的帮助

下面的代码将对与您的模式匹配的URL执行永久重定向:

RewriteRule ^destinations/(.*)/feed$ /category/destination/$1/feed [L,R=301]

我希望这有帮助

下面的代码将对与您的模式匹配的URL执行永久重定向:

RewriteRule ^destinations/(.*)/feed$ /category/destination/$1/feed [L,R=301]

我希望这有帮助

谢谢。但是/feed左边的文件夹是动态的(任何国家名称):url称为/destinations/(country)/feed,应该成为/category/destinations/(country)/feed。换句话说:在调用url之前添加/category如何做?不客气。我刚刚更新了我的答案,以符合您的模式,请随时让我知道这是否更好。嗨,布鲁诺,谢谢!我很想说“完成”,但无论如何它都不是。我不得不稍微改变一下你的解决方案,因为新的url不包含“目的地”,而是“目的地”。现在就是这样:RewriteRule^destinations/(.*)/feed$/category/destination/$1/feed[L,R=301]你是在RewriteEngine打开后才放置我的规则的吗?抱歉,这是完整的评论:你好,布鲁诺,谢谢!我很想说“完成”,但无论如何它都不是。我不得不稍微改变一下你的解决方案,因为新的url不包含“目的地”,而是“目的地”。现在就是这样:RewriteRule^destinations/(.*)/feed$/category/destination/$1/feed[L,R=301],但如果我接到一个类似/destinations/rusia/feed的电话,就会显示起始页。但是如果我打电话给/category/destination/rusia/feed,我就会得到RSS提要。有什么主意吗?谢谢。但是/feed左边的文件夹是动态的(任何国家名称):url称为/destinations/(country)/feed,应该成为/category/destinations/(country)/feed。换句话说:在调用url之前添加/category如何做?不客气。我刚刚更新了我的答案,以符合您的模式,请随时让我知道这是否更好。嗨,布鲁诺,谢谢!我很想说“完成”,但无论如何它都不是。我不得不稍微改变一下你的解决方案,因为新的url不包含“目的地”,而是“目的地”。现在就是这样:RewriteRule^destinations/(.*)/feed$/category/destination/$1/feed[L,R=301]你是在RewriteEngine打开后才放置我的规则的吗?抱歉,这是完整的评论:你好,布鲁诺,谢谢!我很想说“完成”,但无论如何它都不是。我不得不稍微改变一下你的解决方案,因为新的url不包含“目的地”,而是“目的地”。现在就是这样:RewriteRule^destinations/(.*)/feed$/category/destination/$1/feed[L,R=301],但如果我接到一个类似/destinations/rusia/feed的电话,就会显示起始页。但是如果我打电话给/category/destination/rusia/feed,我就会得到RSS提要。有什么想法吗?