make example.com/user/Bob转到profile.php?user = Bob

时间:2010-10-09 04:20:20

标签: apache .htaccess mod-rewrite url-rewriting apache2

我当前的http访问文件是

# Pound sign comments a line out

# Disallow viewing of htaccess files
<Files .htaccess>
order allow,deny
deny from all
</Files>

Options +FollowSymLinks
RewriteEngine On

# enable hiding php extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php 

现在它只是隐藏.php,我仍然想隐藏.php但允许网站/用户/用户名

1 个答案:

答案 0 :(得分:1)

你走了:

RewriteEngine On
RewriteRule ^user/(.*) profile.php?user=$1 [L]