繁体   English   中英

如何删除URL的一部分并排除.htaccess中的重写路径?

[英]How to remove part of URL and exclude path from rewriting in .htaccess?

我的.htaccess中有这个:

RewriteEngine on 
RewriteRule !^/clients/index.php
RewriteRule ^clients/(.*) $1/$2

想法是用URL中的客户端重写所有url(例如,将mydomain.com/clients/cart.php更改为mydomain.com/cart.php ),但将此规则排除在mydomain.com/clients/index.php之外

使用上面的规则,没有我的排除规则会很好,但是当我添加RewriteRule !^/clients/index.php规则时,我会看到内部服务器错误。

问题是如何从重写中排除完整路径?

更改

RewriteRule
!^/clients/index.php

RewriteCond %{REQUEST_URI} !^/clients/index.php

重写:

RewriteEngine on 
RewriteCond %{REQUEST_URI} !^/clients/index.php
RewriteRule ^clients/(.*) $1/ [NC,L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM