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! Quote Link to comment 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 Quote Link to comment 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! Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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) Quote Link to comment 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. Quote Link to comment 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.