htaccess的第一个文件夹不能正常工作与破折号破折号、第一个、不能正常、文件夹

由网友(欲擒故纵纵然满城骚动@)分享简介:我的网址是这样的: http://example.com/apple_a/ 我使用这个规则:RewriteEngine On RewriteRule ^([^_]*)-+(.*)$ $1_$2 [L,NC]这是取代其他网址如 http://example.com/apple/a_a/a_b以 http://e...

我的网址是这样的: http://example.com/apple_a/

我使用这个规则:

RewriteEngine On  
RewriteRule ^([^_]*)-+(.*)$ $1_$2 [L,NC]

这是取代其他网址如 http://example.com/apple/a_a/a_b以 http://example.com/apple/aa/ab (下划线与破折号),但是当我在这样的第一个目录写_ http://example.com/apple- A / AA / ,那么它抛出404错误。

this is replacing other URL's like http://example.com/apple/a_a/a_b to "http://example.com/apple/a-a/a-b" (underscore with dashes) but when I write "_" in first directory like this "http://example.com/apple-a/a-a/" then its throwing 404 error.

所以,我希望这样的工作不知何故。请大家帮帮忙。

So I wants that working somehow. Please help.

推荐答案

正确的规则将是:

RewriteEngine On  
RewriteRule ^([^-]*)-+(.*)$ $1_$2 [L,NC]

([^ _ *)而不是([^ ​​- ] *)

阅读全文

相关推荐

最新文章