【问题标题】:remove numeric characters from start of URLs in .htaccess从 .htaccess 中的 URL 开头删除数字字符
【发布时间】:2013-07-20 09:22:23
【问题描述】:

谁能解释我如何将 /47-mycat1/subcat1-1/13articleid-articlename.html 重定向到 /mycat1/subcat1-1/13articleid-articlename.html 和 将 /17-mycat3/subcat3-2/97articleid-articlename.html 重定向到 /mycat3/subcat3-2/97articleid-articlename.html? 事实上,我想删除第一个网址中的“47-”和第二个网址中的“17-”。

我的所有网址都类似于http://www.mysite.com/SOMENUMBSER-.......

我使用 RewriteRule ^/([0-9]+)-$ http://www.mysite.com/$1 [R] 删除“SOMENUMBSER-”,但它不起作用:(

请帮忙。

【问题讨论】:

  • 我在 joomla 2.5 上安装了Multicategories Component,但我无法在首页查看我的精选内容。 my site 菜单的大多数类型是 Multicategories » Category Blog 或 Multicategories » Category List。我想也许我可以通过将我的特色内容重定向到我的菜单内容来解决我的问题。

标签: .htaccess url redirect


【解决方案1】:

试试这个代码:

RewriteEngine On
RewriteRule ^[0-9]+-(.*)$ /$1 [R=301]

第二行代码捕捉到数字后面的url,重定向到没有数字的url。

【讨论】:

【解决方案2】:

我终于找到了一个临时解决方案! 我关闭了用户 url 重写并在我的 .htaccess 文件末尾添加以下代码

RewriteBase /
RewriteRule ^index\.php/[0-9]+-(.*)$ /$1 [R=301]
RewriteRule ^index\.php/(.*)$ /$1 [R=301]

view seo setting image

view .htaccess file

我的网站 www.barvarionline.com 现在可以了

感谢 Lucas Willems 的帮助 :)

【讨论】:

  • 我卸载了多类别组件,现在我在 joomla 中使用 k2。
猜你喜欢
  • 2014-09-30
  • 1970-01-01
  • 2014-04-08
  • 2012-11-28
  • 1970-01-01
  • 1970-01-01
  • 2023-03-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多