Jarek P Jarek P - 1 year ago 61
PHP Question

RewriteRule I guess?

Is it possible to change the link using RewriteRule or something in .htaccess?




To display it I'm using:

$user = $_GET['user'];
<title><?php echo $user; ?></title>

Answer Source

If you want to access www/player/?user=testuser

using the clean url

www/player/testuser you can use the following rule in your root/.htaccess

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^player/(.+)$ /player/?user=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^clan/(.+)$ /clan/?tag=$1 [L]

This will internally redirect

  • www/player/testuser


  • www/player/?user=testuser
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download