【问题标题】:i need to add paramters in a url if user only enters the domain name using htaccess如果用户只使用 htaccess 输入域名,我需要在 url 中添加参数
【发布时间】:2014-05-22 13:19:01
【问题描述】:

我有域名,如果在 url 中没有像“http://example.com”这样传递的内容,我必须重定向 url
然后我必须像这里一样重定向
http://www.example.com/abc/1/2/3
所以如果 url 在域之后没有任何内容,除了“/”,那么我必须使用我指定的 url 重定向

RewriteCond %{REQUEST_URI} !(.*)
RewriteRule ^ mydomain.com

【问题讨论】:

    标签: .htaccess redirect url-rewriting


    【解决方案1】:

    这应该可行:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www\.example\.com [OR]
    RewriteCond %{HTTP_HOST} ^example\.com [NC]
    RewriteRule ^$ /abc/1/2/3 [R=302,L]
    

    它应该只将example.com重定向到example.com/abc/1/2/3

    【讨论】:

    • Great Dude 它为我工作我没有 15 岁以上,所以我不能投票 ++ 投票
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-19
    • 2017-03-29
    • 1970-01-01
    • 2016-07-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多