David Nelson Posted April 18, 2008 Share Posted April 18, 2008 Hey guys, For a special project I'm doing I need a .php page to show up as either a different extension in the address bar or no extension at all (i.e., right now it is search.php?action=XXXXX, I want it to be simply search?action=XXXXX) or something to that extent. Do I need to do something with my server mime types or what? Thanks! Link to comment https://forums.phpfreaks.com/topic/101792-php-extension-change-in-browser/ Share on other sites More sharing options...
p2grace Posted April 19, 2008 Share Posted April 19, 2008 Htaccess file editing. http://roshanbh.com.np/2008/02/hide-php-url-rewriting-htaccess.html Link to comment https://forums.phpfreaks.com/topic/101792-php-extension-change-in-browser/#findComment-520837 Share on other sites More sharing options...
David Nelson Posted April 19, 2008 Author Share Posted April 19, 2008 Thanks man, I'm on a Windows server, though, any ideas for that? Thanks! Link to comment https://forums.phpfreaks.com/topic/101792-php-extension-change-in-browser/#findComment-520904 Share on other sites More sharing options...
Caesar Posted April 19, 2008 Share Posted April 19, 2008 PHP on Windows sucks....because of Windows. And especially in CGI mode. Also.... http://youdomain.com/?pid=2&search=12 Simplified example.. "index.php" <?php function getContent() { $pageID = $_GET['pid']; switch($pageID) { case 2: Search($_GET['search']); break; default: mainContent(); } } function mainContent() { //Whatever dude. Load a template file or add your HTML here. } getContent(); ?> Instead of using/linking to a million diferent PHP files...just use functions or even include files and add some kind of conditional statement that determines what content to load. Technically, you don't need to have the extension in the url. Apache mod_rewrite would be much nicer than this though. Link to comment https://forums.phpfreaks.com/topic/101792-php-extension-change-in-browser/#findComment-520922 Share on other sites More sharing options...
khalidorama Posted April 19, 2008 Share Posted April 19, 2008 hi, Refer to this : http://www.php24hours.com/viewtopic.php?f=39&t=18&p=27#p27 Link to comment https://forums.phpfreaks.com/topic/101792-php-extension-change-in-browser/#findComment-520929 Share on other sites More sharing options...
David Nelson Posted April 19, 2008 Author Share Posted April 19, 2008 Thanks I was able to just make the php an index page and go directory/?action=XXXXX That worked well, but does anyone know how I would go about making it so the form submits to directory/ but doesn't add in index.php on the next page? Link to comment https://forums.phpfreaks.com/topic/101792-php-extension-change-in-browser/#findComment-520945 Share on other sites More sharing options...
David Nelson Posted April 19, 2008 Author Share Posted April 19, 2008 Anyone? What I just mentioned would be my easiest solution since I'm on a shared server where I couldn't install any IIS stuff. Link to comment https://forums.phpfreaks.com/topic/101792-php-extension-change-in-browser/#findComment-521367 Share on other sites More sharing options...
p2grace Posted April 19, 2008 Share Posted April 19, 2008 You could submit it to a specific page then redirect back to the folder Link to comment https://forums.phpfreaks.com/topic/101792-php-extension-change-in-browser/#findComment-521381 Share on other sites More sharing options...
David Nelson Posted April 19, 2008 Author Share Posted April 19, 2008 How would that work? (Pardon my inexperience) Link to comment https://forums.phpfreaks.com/topic/101792-php-extension-change-in-browser/#findComment-521388 Share on other sites More sharing options...
p2grace Posted April 19, 2008 Share Posted April 19, 2008 Post to any given page (i.e. post.php). Then when finished processing redirect back to the folder page with a get var so that page knows if the processing was successful. You'd redirect with the command: header("Location: ../dir/?command=success"); // if successful, or command=fail if failed. Really simple example but the idea should work. Link to comment https://forums.phpfreaks.com/topic/101792-php-extension-change-in-browser/#findComment-521530 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.