wait Posted November 21, 2012 Share Posted November 21, 2012 I've searched google for this and I'm not 100% sure if this is even a .php related request but... I'm attempting to create (for lack of better description) "false directories" that prevent the .php extention from displaying in specific URLs. I'm creating user profiles for my site and rather than display: .com/u/username.php I would like to display: .com/u/username I have a feeling this might be server related. Shot in the dark. Hope someone can shead some light on this for me. Thanks as always! Quote Link to comment https://forums.phpfreaks.com/topic/270960-false-directory-to-hide-php-extention-in-url-ex-comblah-not-comblahphp/ Share on other sites More sharing options...
Jessica Posted November 21, 2012 Share Posted November 21, 2012 Mod rewrite. Quote Link to comment https://forums.phpfreaks.com/topic/270960-false-directory-to-hide-php-extention-in-url-ex-comblah-not-comblahphp/#findComment-1393967 Share on other sites More sharing options...
wait Posted November 21, 2012 Author Share Posted November 21, 2012 Great! Thanks. That is what I was looking for. Now if only I could update my avatar. This feature seems to be disabled on my profile. Any thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/270960-false-directory-to-hide-php-extention-in-url-ex-comblah-not-comblahphp/#findComment-1393971 Share on other sites More sharing options...
play_ Posted November 21, 2012 Share Posted November 21, 2012 just out of curiosity, why are you doing it this way? (one script per user) what if you have 100,000 users? Quote Link to comment https://forums.phpfreaks.com/topic/270960-false-directory-to-hide-php-extention-in-url-ex-comblah-not-comblahphp/#findComment-1393972 Share on other sites More sharing options...
wait Posted November 21, 2012 Author Share Posted November 21, 2012 (edited) Well, I'm open for suggestions. I have a directory called /u/ and would like the username or profile page not to have a .php extension. I would like to handle this in the most efficient way. Just don't know how to go about it. I read this can be handled in .htaccess but if there is a better way.... I'm open. - Stupid question (avatar) Got it. Edited November 21, 2012 by wait Quote Link to comment https://forums.phpfreaks.com/topic/270960-false-directory-to-hide-php-extention-in-url-ex-comblah-not-comblahphp/#findComment-1393973 Share on other sites More sharing options...
play_ Posted November 21, 2012 Share Posted November 21, 2012 (edited) This is now how this is typically done: Ideally you would have one page. say, user.php you would link to that page with a variable, like site.com/user.php?id=135 or site.com/user.php?u=wait you would then use $_GET['id'] and query a database for that members info. whichever way, you'll still need mod rewrite to do what you want Edited November 21, 2012 by play_ Quote Link to comment https://forums.phpfreaks.com/topic/270960-false-directory-to-hide-php-extention-in-url-ex-comblah-not-comblahphp/#findComment-1393975 Share on other sites More sharing options...
wait Posted November 21, 2012 Author Share Posted November 21, 2012 Makes a bit more sense doing it your way. Time for some more coffee. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/270960-false-directory-to-hide-php-extention-in-url-ex-comblah-not-comblahphp/#findComment-1393976 Share on other sites More sharing options...
play_ Posted November 21, 2012 Share Posted November 21, 2012 this will work with the way youre originally asked in your .htaccess: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ $1.php [L,QSA] Quote Link to comment https://forums.phpfreaks.com/topic/270960-false-directory-to-hide-php-extention-in-url-ex-comblah-not-comblahphp/#findComment-1393980 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.