如果url包含catalogsearch / result /?q =使用.htaccess进行SOMETHING,Apache会将URL重写为小写

时间:2017-09-02 12:08:37

标签: apache .htaccess redirect

2 个答案:

答案 0 :(得分:2)

添加到.htaccess似乎过于沉重。虽然在相关页面上添加它(例如在PHP中)非常简单和高效。

在PHP中(位于页面顶部):

$_GET['q'] = strtolower($_GET['q']);

答案 1 :(得分:1)

首先需要添加虚拟主机配置:

<div class="col-md-6 col-sm-12 text-center worker">
                        <div class="p-lr40 p-t30 p-b40 clearfix mack-an-appointment black">
                            <form method="post" class="dzForm" action="script/contact.php">
                            <input type="hidden" value="Appoinment" name="dzToDo" >
                            <div class="row">
                                <div class="text-white text-center">
                                    <h2 class="h2 m-t0">Programare<span class="text-primary">online!</span></h2>
                                    <div class="dez-separator-outer"><div class="dez-separator bg-primary style-liner"></div></div>
                                    <p class="title-small">Folositi acest formular pentru a solicita o programare.<br></p>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                            <input name="dzName" class="form-control" placeholder="Nume" type="text">
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                            <input name="dzEmail" class="form-control" placeholder="Email" type="text">
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                            <input name="dzOther[Telefon]" class="form-control" placeholder="Telefon" type="text">
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                            <select class="bs-select-hidden" name="dzOther[Departament]" >
                                               <option value="admin">Secretariat</option>
                                               <option value="accounts">Casierie</option>
                                               <option value="management">Decanat</option>
                                               <option value="sdut">Cancelarie studenti</option>
                                            </select>
                                    </div>
                                </div>
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <div class="input-group">
                                            <textarea name="dzMessage" rows="4" class="form-control" required=""></textarea>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-12 text-center">
                                    <div class="dzFormMsg" ></div>
                                    <button name="Reset" value="Reset" type="reset" class="site-button skew-secondry"><span>Reseteaza</span></button>
                                    <button name="submit" type="submit" value="Submit" class="site-button skew-secondry"><span>Trimite</span></button>

然后,在.htaccess中添加以下行:

** EDITED符合@croises更正**

RewriteMap tolower int:tolower 

注意:您需要重启apache才能使其正常工作

note2:它不仅会使整个网址小写