.htaccess htaccess屏蔽一系列URL';s到更可读的版本,但显示来自原始URL的内容

.htaccess htaccess屏蔽一系列URL';s到更可读的版本,但显示来自原始URL的内容,.htaccess,mod-rewrite,url-rewriting,rewrite,.htaccess,Mod Rewrite,Url Rewriting,Rewrite,下面是一个电子商务商店上的过滤器URL示例 http://www.domain.com/showering/showers/filter/alliance http://www.domain.com/showering/showers/filter/aquaflow http://www.domain.com/showering/showers/filter/grohe http://www.domain.com/showering/showers/filter/mira 我想知道是否有一种方

下面是一个电子商务商店上的过滤器URL示例

http://www.domain.com/showering/showers/filter/alliance
http://www.domain.com/showering/showers/filter/aquaflow
http://www.domain.com/showering/showers/filter/grohe
http://www.domain.com/showering/showers/filter/mira
我想知道是否有一种方法可以屏蔽这些URL,使它们看起来像:-

http://www.domain.com/alliance-showers
http://www.domain.com/aquaflow-showers
http://www.domain.com/grohe-showers
http://www.domain.com/mira-showers
但是仍然显示
/showering/showers/*
URL中的页面内容

然后,我希望能够基于这些屏蔽URL设置规范URL

我玩过无数的变奏,但收效甚微,但到目前为止,我已经做到了:-

RewriteEngine on
RewriteCond %{HTTP_HOST} !^/showering/showers/filter/(alliance)
RewriteRule (.*) /alliance-showers/
当这应用于网站时,Magento商店中的所有图像都不会附带加载,而且URL根本不会更改

答案是。。。 .htaccess文件位于root或Magento安装中。这是文件中的第一条规则,如下所示:-

############################################
## enable rewrites

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^([^-]+)-([^/]+)/?$ /showering/$2/filter/$1 [L,R]
目前正在测试:-

想要表现为:-

http://www.showermania.co.uk/alliance-showers

当前答案对此URL没有任何影响/更改。谢谢。

您可以使用如下规则:

RewriteEngine on

RewriteRule ^showering/([^/]+)/filter/([^/]+)/?$ /$2-$1 [L,NC]

感谢@anubhava-这似乎对当前的URL没有任何影响。想知道这是否是由于放置在
.htaccess
中造成的。仍在测试中。不,不幸的是,根本无法让它工作。无论我将URL放在
.htaccess
中的哪个位置,它都不会更改URL(加载
.htaccess
中的其他内容生效)。请参阅更新的规则,并确保这是根.htaccess文件中的第一条规则。请告诉我有关这个问题的所有细节。哪个URL不起作用以及这个.htaccess文件的位置?现在它正在做一些事情,谢谢。好的,这会重定向到“/alliance Burses”,而我只想映射/屏蔽URL,但仍然在
/sparhing-sparys/filter/alliance
上显示内容。谢谢。好的,我从规则中取出了
R
标志,现在试试。但我怀疑Magento可能不喜欢(你之前没有告诉我Magento的事)
RewriteEngine on

RewriteRule ^showering/([^/]+)/filter/([^/]+)/?$ /$2-$1 [L,NC]