SennNathan Posted January 18, 2015 Share Posted January 18, 2015 Im setting up members on my site i want the profile url to be like www.mywebsite.com/NATHAN but not go to a folder on my server called nathan but instead go to mywebsite.com/?profile=Nathan Link to comment https://forums.phpfreaks.com/topic/294030-how-to-redirect-url/ Share on other sites More sharing options...
Ch0cu3r Posted January 18, 2015 Share Posted January 18, 2015 You would use mod_rewrite for this. Have the following in a .htaccess file in your sites document root. RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([\w]+)?$ index.php?profile=$1 Then output your links in the new format, eg $username = 'Nathan'; // users username echo '<a href="/'.$username.'">'.$username.'</a>'; // output link in the new format Link to comment https://forums.phpfreaks.com/topic/294030-how-to-redirect-url/#findComment-1503328 Share on other sites More sharing options...
SennNathan Posted January 18, 2015 Author Share Posted January 18, 2015 That worked thanks Link to comment https://forums.phpfreaks.com/topic/294030-how-to-redirect-url/#findComment-1503339 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.