【问题标题】:Canonical url htaccess规范网址 htaccess
【发布时间】:2017-11-30 02:47:39
【问题描述】:

我正在尝试通过 htaccess 文件实现某些目标。 我想要这个

http://mypage.com/e-store/561/ http://mypage.com/e-store/562/

看起来像这样

http://mypage.com/tv-screens http://mypage.com/computers

我已经读到可以通过 htaccess 重写 url。但我无法理解它。

【问题讨论】:

    标签: .htaccess redirect url-rewriting friendly-url canonical-link


    【解决方案1】:

    使用这是 .htaccess 文件:

    RewriteRule ^([-a-zA-Z0-9_]+)/$ ?url=$1 [L]
    

    并将您的代码输出页面添加为:

    http://mypage.com/?url=tv-screens
    

    在参数 URL 上显示必要页面的位置。

    此链接不显示页面屏幕名称:

    http://mypage.com/e-store/561/
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-15
    • 1970-01-01
    相关资源
    最近更新 更多