将现有 URL 重定向到新方案 .htaccess
Redirect existing URL to a new scheme .htaccess
注意:一开始我们重定向 https://domain.com/stats.php?player=name to https://domain.com/p/name (so some of the answers may pertain to that), but now I am redirecting to https://domain.com/@name
不过还有一个未解决的问题。我希望在访问时制作 https://domain.com/stats.php?player=name automatically redirect to https://domain.com/@name。
<IfModule mod_rewrite.c>
ErrorDocument 404 /404.php
RewriteRule ^@(\w+)$ stats.php?player=
Options +FollowSymlinks
Options -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ .php [NC,L]
</ifModule>
创建 .htaccess 文件或使用 apache 重写:http://httpd.apache.org/docs/current/mod/mod_rewrite.html
规则是:
RewriteEngine On
RewriteRule ^p/(\w+)$ stats.php?player=
注意:一开始我们重定向 https://domain.com/stats.php?player=name to https://domain.com/p/name (so some of the answers may pertain to that), but now I am redirecting to https://domain.com/@name
不过还有一个未解决的问题。我希望在访问时制作 https://domain.com/stats.php?player=name automatically redirect to https://domain.com/@name。
<IfModule mod_rewrite.c>
ErrorDocument 404 /404.php
RewriteRule ^@(\w+)$ stats.php?player=
Options +FollowSymlinks
Options -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ .php [NC,L]
</ifModule>
创建 .htaccess 文件或使用 apache 重写:http://httpd.apache.org/docs/current/mod/mod_rewrite.html
规则是:
RewriteEngine On
RewriteRule ^p/(\w+)$ stats.php?player=