繁体   English   中英

mod_rewrite使用或不使用Slash重写URL

[英]mod_rewrite URL rewriting with or without Slash

写出.htacess的正确方法是什么,以便www.domain.com/about_us和www.domain.com/about_us/访问www.domain.com/about_us.php

目前,我所拥有的是以下内容,只是想知道是否有办法将它放在一行中

选项+ FollowSymLinks
RewriteEngine on
RewriteRule ^(about)$ /about_us.php
RewriteRule ^(about /)$ /about_us.php

这是一个正则表达式,所以添加? 之后/将进行/可选(0或1次出现)。 此外,括号是不必要的:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^about/?$ /about_us.php
RewriteRule ^about/?$ /about_us.php

暂无
暂无

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

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