KhaledBawz Posted August 7, 2013 Author Share Posted August 7, 2013 (edited) yes, it's .htaccess code and works for me www.mysite.com/profile-abc.htm Edited August 7, 2013 by KhaledBawz Quote Link to comment https://forums.phpfreaks.com/topic/280825-change-links-using-htaccess/page/2/#findComment-1443846 Share on other sites More sharing options...
jazzman1 Posted August 7, 2013 Share Posted August 7, 2013 Let me see the content of your .htaccess file. Quote Link to comment https://forums.phpfreaks.com/topic/280825-change-links-using-htaccess/page/2/#findComment-1443848 Share on other sites More sharing options...
KhaledBawz Posted August 7, 2013 Author Share Posted August 7, 2013 (edited) okay RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*)/$ $1 [R,L] RewriteRule ^([a-zA-Z0-9_-]+)$ $1\.php [L,QSA] Options +FollowSymLinks RewriteRule profile-(.*)$ profile.php?username=$1 now the links is: www.mysite.com/profile-abc Edited August 7, 2013 by KhaledBawz Quote Link to comment https://forums.phpfreaks.com/topic/280825-change-links-using-htaccess/page/2/#findComment-1443855 Share on other sites More sharing options...
jazzman1 Posted August 7, 2013 Share Posted August 7, 2013 Hey @KhaledBawz, not too much time today but when I ran your script I've got a fake result: Array ( [username] => jazzman.php ) But, userName is just jazzman, not jazzman.php, right? Secondly, what about if you have inheritance in your files, so one URL goes to second then goes to third and so on? Anyway, I am glad to see that you sorted out this issue. Have a nice day, jazz. Quote Link to comment https://forums.phpfreaks.com/topic/280825-change-links-using-htaccess/page/2/#findComment-1443858 Share on other sites More sharing options...
KhaledBawz Posted August 7, 2013 Author Share Posted August 7, 2013 about the fake result I just fixed now, I didn't notice it last time RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^/?([a-z]+)$ $1.php [L] Options +FollowSymLinks RewriteRule profile-(.*)$ profile.php?username=$1 all links is working fine, no any duplicated in path thank you jaz I appreciate your help Quote Link to comment https://forums.phpfreaks.com/topic/280825-change-links-using-htaccess/page/2/#findComment-1443861 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.