TheMovieman Posted June 26, 2008 Posted June 26, 2008 (edited) I didn't know how to quite describe my question in the topic, but I believe it has to with scripting, so I hope this is in the right section. Looking around the Net, I notice some sites have URLs to pages like this: www.somesite.com/folder/page How do they do this without an extension? I'd like to do the same thing or somethign similar. For instance my review of "The Closer": www.moviemansguide.com/reviews/DVD/read.php?id=closer-season3 Is there a way to make it: www.moviemansguide.com/reviews/DVD/closer-season3 or closer-season3.html? Edited June 26, 2008 by TheMovieman Quote
TCH-Bruce Posted June 26, 2008 Posted June 26, 2008 They are most likely using some sort of CMS package where the post title becomes the URL. Blogs do this using a method called Permalinks. It's basicly a translation done in the .htaccess file. Quote
Gabi ~ ClaytonWorks Posted June 27, 2008 Posted June 27, 2008 www.somesite.com/folder/page How do they do this without an extension? I'd like to do the same thing or somethign similar. For instance my review of "The Closer": I'm not sure about the /page part, but if you have a folder and the url is www.somesite.com/folder/ and you have an index.htm (or index.html) inside that folder, then www.somesite.com/folder/ will take you to the index page without you having to type /index.htm Quote
OJB Posted June 27, 2008 Posted June 27, 2008 As Bruce said, its by using RewriteRule in your .htaccess file - essentially it is apache mod_rewriting but not done at a server level but rather directory level (as on shared hosting you obviously don't get access to the http.conf file) have a read of this: http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html Quote
TCH-Dick Posted June 28, 2008 Posted June 28, 2008 Try this in your htaccess file >RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^([^/]+)/?$ /read.php?id=$1 [QSA,L] Quote
TheMovieman Posted June 28, 2008 Author Posted June 28, 2008 Thanks for the help. I'll give it a try later on Quote
TheMovieman Posted June 30, 2008 Author Posted June 30, 2008 Well, I gave it a try and it didn't work. I have a few htaccess files (one on the main and another in the "reviews" folder. Tried for both and it didn't work. Thanks for helping, though. Quote
TheMovieman Posted July 1, 2008 Author Posted July 1, 2008 I should mention that when I did try, I got a 404 error. Quote
OJB Posted July 2, 2008 Posted July 2, 2008 If its a 404 then it means that the page you have pointed it to doesn't exist... So i guess its something to do with: RewriteRule ^([^/]+)/?$ /read.php?id=$1 [QSA,L] Im no good at mod_rewrite so I dont know If it was a 500 error it would have been a .htaccess error.. so I imagine its that line I have pasted above. Its possibly looking in the wrong directory? Not sure Quote
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.