【问题标题】:How can I hide the directory name to the end user via .htacess如何通过 .htaccess 向最终用户隐藏目录名称
【发布时间】:2014-04-04 09:05:32
【问题描述】:

我怎样才能建立这个链接

http(with or without s)://(with or without www).puaction.com/articles/Top-7-Best-Pheromone-Colognes-for-Men

看起来像这样:

https://puaction.com/Top-7-Best-Pheromone-Colognes-for-Men

articles 目录中的每个文件夹都将显示没有 article 目录所以...

http(with or without s)://(with or without www).puaction.com/articles/(any article)

将是(非www/https/文章目录最终用户不会显示)

https://puaction.com/ {any article name}

【问题讨论】:

    标签: .htaccess url https


    【解决方案1】:

    您可以在 root .htaccess 中使用此代码:

    RewriteEngine On
    
    RewriteCond %{THE_REQUEST} \s/+articles/([\S+) [NC]
    RewriteRule ^ https://puaction.com/%1? [R=301,L,NE]
    
    RewriteRule ^([^/.]+)/?$ /articles/$1 [L]
    

    【讨论】:

      猜你喜欢
      • 2014-07-08
      • 1970-01-01
      • 1970-01-01
      • 2020-08-16
      • 1970-01-01
      • 2015-07-10
      • 2015-07-12
      • 1970-01-01
      • 2017-01-28
      相关资源
      最近更新 更多