2017-02-24 63 views
1

我需要从我的URL末尾删除文本。该网址看起来像财产以后如下:删除URL中的尾部文本

  1. www.test.co.za/news/cat/index-mobile.html
  2. www.test.co.za/page-name/index-mobile .html

我需要从URL中删除index-mobile.html。

预先感谢您。

回答

1

您可以在网站根目录的.htaccess使用这样的规则:

RewriteEngine On 

RewriteCond %{THE_REQUEST} \s/+(.*)/index-mobile\.html\s [NC] 
RewriteRule^/%1? [R=301,L,NE] 

# rest of your rules ho here 
+0

你好,是的,它完美! –