【问题标题】:htaccess for creating clean url for application hosted on sub-domainhtaccess 为托管在子域上的应用程序创建干净的 url
【发布时间】:2016-09-03 23:27:01
【问题描述】:

以下是正在使用的此应用程序生成的一些 url 示例。我想使用 htaccess 使 url 干净:

示例:http://subdomain.domain.com/index.php?folder=abc&file=xyz&variable1=pqr&variable2=123

最终网址应如下所示: http://subdomain.domain.com/abc/xyz/pqr 基本上所有参数都应该出现在斜杠之后。

请帮忙!

【问题讨论】:

    标签: php apache .htaccess redirect mod-rewrite


    【解决方案1】:

    你可以看看in this topic

    RewriteEngine On
    RewriteBase /
    RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ index.php?folder=$1&file=$2&variable1=$3
    

    【讨论】:

    • 让我检查一下。其中,请注意,url 是动态创建的,它们可能有也可能没有文件或变量。并且变量名称也会根据点击而变化。
    • 这应该可以工作,对于域之后的这个 url:'abc/xyz/pqr'。您是否将 htaccess 文件放在子域中的正确位置?
    • 我把它放在文件夹 subdomain_domain_com
    猜你喜欢
    • 2014-02-09
    • 1970-01-01
    • 1970-01-01
    • 2013-09-22
    • 1970-01-01
    • 2013-12-02
    • 1970-01-01
    • 2015-02-25
    • 2015-11-01
    相关资源
    最近更新 更多