Derleek Posted August 28, 2008 Share Posted August 28, 2008 Ok, so I would like the ability to not display the .php file extension on some of my pages. Is apache mod_rewrite what i'm looking for? I just don't want to choke down this article if It's not even what i'm looking for... lol Quote Link to comment https://forums.phpfreaks.com/topic/121738-looking-to-ditch-the-php-extension/ Share on other sites More sharing options...
rhodesa Posted August 28, 2008 Share Posted August 28, 2008 yeah, mod_rewrite is the way to go. if you want a DIFFERENT extension, like .html pages running like PHP pages, that is something different though Quote Link to comment https://forums.phpfreaks.com/topic/121738-looking-to-ditch-the-php-extension/#findComment-628024 Share on other sites More sharing options...
zq29 Posted August 28, 2008 Share Posted August 28, 2008 yeah, mod_rewrite is the way to go. if you want a DIFFERENT extension, like .html pages running like PHP pages, that is something different though You can mask php pages as html pages with mod_rewrite too... Though there are other ways of course. Quote Link to comment https://forums.phpfreaks.com/topic/121738-looking-to-ditch-the-php-extension/#findComment-628042 Share on other sites More sharing options...
TheFilmGod Posted August 29, 2008 Share Posted August 29, 2008 hey - I was wondering if someone can explain to me how mod_rewrite works! I know that you can change the url / name of the a page, but what if a user copies and pastes the link... would it still work? Quote Link to comment https://forums.phpfreaks.com/topic/121738-looking-to-ditch-the-php-extension/#findComment-628378 Share on other sites More sharing options...
trq Posted August 29, 2008 Share Posted August 29, 2008 hey - I was wondering if someone can explain to me how mod_rewrite works! I know that you can change the url / name of the a page, but what if a user copies and pastes the link... would it still work? Yes it will still work. it is simply a way to have apache map one url to another. eg; http://yourdomain.com/foo/bar -> http://yourdomain.com/index.php?section=foo&article=bar Quote Link to comment https://forums.phpfreaks.com/topic/121738-looking-to-ditch-the-php-extension/#findComment-628383 Share on other sites More sharing options...
TheFilmGod Posted August 29, 2008 Share Posted August 29, 2008 hey - I was wondering if someone can explain to me how mod_rewrite works! I know that you can change the url / name of the a page, but what if a user copies and pastes the link... would it still work? Yes it will still work. it is simply a way to have apache map one url to another. eg; http://yourdomain.com/foo/bar -> http://yourdomain.com/index.php?section=foo&article=bar Yes that makes sense, but ... how does apache know the difference between something it needs to "map" opposed to accessing a file called "bar" in directory "foo". Quote Link to comment https://forums.phpfreaks.com/topic/121738-looking-to-ditch-the-php-extension/#findComment-628385 Share on other sites More sharing options...
akitchin Posted August 29, 2008 Share Posted August 29, 2008 it doesn't know the difference, it simply follows the rules it's given. that's why you have to be careful with your rules. Quote Link to comment https://forums.phpfreaks.com/topic/121738-looking-to-ditch-the-php-extension/#findComment-628388 Share on other sites More sharing options...
wildteen88 Posted August 29, 2008 Share Posted August 29, 2008 hey - I was wondering if someone can explain to me how mod_rewrite works! I know that you can change the url / name of the a page, but what if a user copies and pastes the link... would it still work? Yes it will still work. it is simply a way to have apache map one url to another. eg; http://yourdomain.com/foo/bar -> http://yourdomain.com/index.php?section=foo&article=bar Yes that makes sense, but ... how does apache know the difference between something it needs to "map" opposed to accessing a file called "bar" in directory "foo". You'd do this by setting up a rewrite conditions to check to see if the requested url is not a existing file/directory, example RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # your RewriteRule's continue here Quote Link to comment https://forums.phpfreaks.com/topic/121738-looking-to-ditch-the-php-extension/#findComment-628891 Share on other sites More sharing options...
The Little Guy Posted August 29, 2008 Share Posted August 29, 2008 http://wiki.dreamhost.com/Htaccess_tricks#No_File_Extension Quote Link to comment https://forums.phpfreaks.com/topic/121738-looking-to-ditch-the-php-extension/#findComment-628894 Share on other sites More sharing options...
Derleek Posted August 29, 2008 Author Share Posted August 29, 2008 thanks little_guy. looks like a much easier read then what i found Quote Link to comment https://forums.phpfreaks.com/topic/121738-looking-to-ditch-the-php-extension/#findComment-629069 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.