目录" xx"有几个目录。
我希望当人们访问" domain.com/xx"它们被重定向到" xx"中的一个目录,称为" zzzzz"。
但这不应该影响" xx"。
内的任何其他目录但是,当我写
时redirect 301 /xx /xx/zzzzz
它会导致循环。请帮忙。
答案 0 :(得分:0)
你可以简单地实现这个目标:
RewriteRule ^/?xx/?$ /xx/zzzzz [R,L]
对于请求网址domain.com/xx
或domain.com/xx/
,请重定向到domain.com/xx/zzzzz
答案 1 :(得分:0)
redirect 301 /xx /xx/zzzzz
肯定会导致无限重定向链,因为url模式和目标路径是相同的。 /xx
也匹配目标路径/xx/zzzz
。
您需要排除匹配模式中的/zzzz
细分。您可以使用Redirectmatch
或RewriteRule
来解决问题
Redirectmatch ^/xx((?!/zzzzz).*)$ /xx/zzzz
在测试此重定向之前清除浏览器缓存。
答案 2 :(得分:0)
我找到了这个,它解决了我的问题:
<fieldset data-ng-repeat="banca in banci">
<legend>
Conturi bancare
</legend>
<ng-form name="userFieldForm">
<div class="form-group" ng-class="{'has-error':userFieldForm['contbanca' + $index].$dirty && userFieldForm['contbanca' + $index].$invalid, 'has-success':userFieldForm['contbanca' + $index].$valid}">
<div class="col-md-4">
<label class="control-label">
Cont banca {{$index + 1}}
<span class="symbol required"></span>
</label>
<input type="text" placeholder="Nr. Cont..." class="form-control" name="contbanca{{$index}}" ng-model="myModel.['contbanca' + $index]"
ng-pattern="/[a-zA-Z0-9]{24}/" required/>
<span class="error text-small block" ng-if="userFieldForm.['contbanca' + $index].$dirty && userFieldForm.['contbanca' + $index].$error.required">Va rugam inserati numarul de cont!</span>
<span class="error text-small block" ng-if="userFieldForm.['contbanca' + $index].$error.pattern">Numarul de cont trebuie sa aiba 24 de caractere alfanumerice!</span>
<span class="success text-small block" ng-if="userFieldForm.['contbanca' + $index].$valid">Contul este valid!</span>
</div>
</div>
<div class="form-group" ng-class="{'has-error':userFieldForm.banca.$dirty && userFieldForm.banca.$invalid, 'has-success':userFieldForm.banca.$valid}">
<div class="col-md-4">
<label for="form-field-select-1">
Banca
<span class="symbol required"></span>
</label>
<select class="form-control" name="banca" ng-model="myModel.banca" required>
<option value="" disabled selected>Selectati banca </option>
<option value="AlphaBank">Alpha Bank</option>
<option value="AngloRomanianBank">Anglo-Romanian Bank</option>
<option value="ATEBank">ATE Bank</option>
<option value="BancaCRFirenze">Banca C.R. Firenze</option>
<option value="BancaComercialaCarpatica">Banca Comerciala Carpatica</option>
<option value="EximBank">Exim Bank</option>
<option value="BancaDiRoma">Banca Di Roma</option>
<option value="BancaItaloRomena">Banca Italo Romena</option>
<option value="BancaRomaneasca">Banca Romaneasca</option>
<option value="BancaTransilvania">Banca Transilvania</option>
<option value="Bancpost">Bancpost</option>
<option value="BCR">BCR</option>
<option value="BRD">BRD - Groupe Societe Generale</option>
<option value="CEC">CEC Bank</option>
<option value="CitiBank">Citibank</option>
<option value="CreditEuropeBank">Credit Europe Bank</option>
<option value="EgnatiaBank">Egnatia Bank</option>
<option value="EmporikiBank">Emporiki Bank</option>
<option value="GarantiBank">Garanti Bank</option>
<option value="HVBLocuinte">HVB Locuinte</option>
<option value="INGBank">ING Bank</option>
<option value="LaCaixa">La Caixa</option>
<option value="LeumiBank">Leumi Bank</option>
<option value="LibraBank">Libra Bank</option>
<option value="MarfinBank">Marfin Bank</option>
<option value="MilleniumBank">Millenium Bank</option>
<option value="MKBRomexterraBank">MKB Romexterra Bank</option>
<option value="OTPBank">OTP Bank</option>
<option value="PiraeusBank">Piraeus Bank</option>
<option value="PorscheBank">Porsche Bank</option>
<option value="ProCreditBank">Pro Credit Bank</option>
<option value="RaifaissenBank">Raifaissen Bank</option>
<option value="RaifaissenLocuinte">Raifaissen Locuinte</option>
<option value="RBS">RBS</option>
<option value="RomanianInternationalBank">Romanian International Bank</option>
<option value="SanpaoloImiBank">Sanpaolo Imi Bank</option>
<option value="UniCreditTiriacBank">Unicredit Tiriac Bank</option>
<option value="Volksbank">Volksbank</option>
</select>
<span class="error text-small block" ng-if="userFieldForm.banca.$dirty && userFieldForm.banca.$error.required">Va rugam selectati banca.</span>
<span class="success text-small block" ng-if="userFieldForm.banca.$valid">Banca selectata!</span>
</div>
</div>
<div class="form-group" ng-class="{'has-error':userFieldForm.contbanca.$dirty && userFieldForm.contbanca.$invalid, 'has-success':userFieldForm.contbanca.$valid}">
<div class="col-md-3">
<label for="form-field-select-1">
Banca
<span class="symbol required"></span>
</label>
<select class="form-control" name="banca" ng-model="myModel.banca" required>
<option value="" disabled selected>Selectati moneda </option>
<option value="LEI">LEI</option>
<option value="EURO">EURO</option>
<option value="USD">USD</option>
</select>
<span class="error text-small block" ng-if="userFieldForm.banca.$dirty && userFieldForm.banca.$error.required">Va rugam selectati banca.</span>
<span class="success text-small block" ng-if="userFieldForm.banca.$valid">Banca selectata!</span>
</div>
</div>
<div class="col-md-1" style="margin-top: 22px;">
<input type="button" value="X" class="btn btn-danger" ng-click="removeChoice()" />
</div>
</ng-form>
</fieldset>