Hey everyone, I have created a website where users may register for webspace. I would like them to access their webspace via www.website.com/john , rather than www.website.com/website.php?user=john which of course doesn't look very pretty. I'm using the following code: At least this code redirects every request to website.php instead of pointing to a non existing folder, but it's not passing on the GET variables. When I place a simple echo $_GET['user']; inside website.php , the script outputs website.php and not the username john I requested. Does anyone know why it is not working properly? thx casper
You have to edit the script so it adds the '?user=whatever' part to the URL. Post in the php board. Or, if you're trying to make the links point to the new URL, you have to edit the part of the php file that creates the links. mod_rewrite only makes the URLs work.
thx for replying, Nintendo . However, I think that mod_rewrite could take care of this problem without modifying the PHPfile. This tutorial is using the same method with the difference that the tutorial code is actually working. I know that I'm doing something wrong, since the htaccess file should redirect to website.php?user=john , instead of website.php?user=website.php
whoa got it RewriteEngine on RewriteRule ^([A-Za-z0-9_]+)/?$ website.php?user=$1 [T=application/x-httpd-php,L] RewriteRule ^([A-Za-z0-9_]+)/([A-Za-z0-9_]+)/?$ website.php?user=$1 [T=application/x-httpd-php,L]