将现有URL重定向到新方案.htaccess

时间:2015-01-20 18:08:25

标签: .htaccess apache2

注意:一开始我们将https://domain.com/stats.php?player=name重定向到https://domain.com/p/name(所以有些答案可能与此有关),但现在我正在重定向到https://domain.com/@name

但仍有一个未解决的问题。我希望https://domain.com/stats.php?player=name在访问时自动重定向到https://domain.com/@name

<IfModule mod_rewrite.c>
ErrorDocument 404 /404.php
RewriteRule ^@(\w+)$ stats.php?player=$1
Options +FollowSymlinks
Options -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
</ifModule>

1 个答案:

答案 0 :(得分:2)

创建.htaccess文件或使用apache重写:http://httpd.apache.org/docs/current/mod/mod_rewrite.html

规则是:

RewriteEngine On
RewriteRule ^p/(\w+)$ stats.php?player=$1
相关问题