2010-08-12 133 views
1

写出.htacess的正确方法是什么,以便www.domain.com/about_us和www.domain.com/about_us/可访问www.domain.com/about_us。 PHPmod_rewrite带或不带slash的URL重写

目前,我有什么是下面的,只是不知道是否有把它放在一个线

选项+的FollowSymLinks

重写规则RewriteEngine叙述^(大约)$ /about_us.php
方式 RewriteRule ^(about /)$ /about_us.php

回答

1
RewriteRule ^about/?$ /about_us.php 
3

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

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

真棒非常有用:) – Jake 2013-08-11 10:13:35