Scribes Write
Scribes Write
diary of a lone scribbler
Miscellaneous
 Sections  
Home
Search Engines (24/0)
Technology (20/0)
General News (19/0)
Site Updates (8/0)
Quotes (6/0)
What am I? (5/0)

 User Functions  
Username:

Password:

Don't have an account yet? Sign up as a New User

 What's New  
STORIES
No new stories

COMMENTS last 48 hrs
No new comments

LINKS last 2 wks
No recent new links


 Mod Rewrite with .htaccess   
 Author:  Manwah
 Dated:  Monday, August 18 2003 @ 02:20 AM BST
 Topic:  Site Updates  
Site UpdatesWell, I managed to sort out the code for rewriting the url at both the server level and within this CMS. I have currently only rewritten it for the articles, but I should be able to apply it to the rest of the website at my leisure.

To be honest, it wasn't really that difficult when I finally applied myself, but there was an initial case of headscratching as I tried to work out how to get it to work.

If anyone is interested on how to use the .htaccess to rewrite simple urls let me know. Most of the tutorials I read were far too complicated, and I ended up working it out through trial and error.

And to think, one of my old lecturers used to accuse me of being a code hacker rather than a programmer at Uni - what did he know?!


--Added--

So a number of people are looking for some basic code in order to be able to start using mod rewrite in an .htaccess file for their own site.

The following is what I would use in order to change a file story.php?id=007 into the more friendly form story/007.html:

RewriteEngine on
RewriteRule ^story/(.*).html$ /story.php?id=$1 [NC,L]

For further reading, I highly recommend this introduction over at Webmaster World.




 What's Related  
  • .htaccess to rewrite simpl...
  • this introduction
  • Webmaster World
  • More by Manwah
  • More from Site Updates

  •  Story Options  
  • Mail Story to a Friend
  • Printable Story Format


  • Mod Rewrite with .htaccess | 0 comments | Create New Account
    The following comments are owned by whoever posted them. This site is not responsible for what they say.
    No user comments.