0

NOTE: In the beginning we were redirecting 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

There is still one unresolved issue though. I wish to make https://domain.com/stats.php?player=name automatically redirect to https://domain.com/@name when visited.

<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>
  • possible duplicate of [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](http://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained) – lin Jan 20 '15 at 18:18

1 Answers1

2

create a .htaccess file or use apache rewrite: http://httpd.apache.org/docs/current/mod/mod_rewrite.html

The rule is :

RewriteEngine On
RewriteRule ^p/(\w+)$ stats.php?player=$1
harrrrrrry
  • 13,643
  • 2
  • 23
  • 28