Current location: Hot Scripts Forums » Programming Languages » PHP » URL variables and Mod_Rewrite


URL variables and Mod_Rewrite

Reply
  #1 (permalink)  
Old 11-03-10, 04:41 AM
MrWheezy MrWheezy is offline
Newbie Coder
 
Join Date: Sep 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Question URL variables and Mod_Rewrite

Hi all,

It's been a while since my last visit...

The last couple days I've been working on a wallpaper site with back-end. Now I'm having troubles with the concept of URL variables and mod_rewrite

What I want:

/index.php -> /
/index.php?search=blue+orange&page2 -> /search/blue+orange/page/2/
/index.php?tag=blue&page=2 -> /tag/blue/page/2/
/index.php?category=vector&page=2 -> /category/vector/page/2/
/index.php?id=50&name=cool-wallpaper ->/view/50/cool-wallpaper/
/index.php?id=50&name=cool-wallpaper&download=960x800 -> /view/50/cool-wallpaper/download/960x800/

also, www.domain.com should be redirected to domain.com and every URL must have a trailing slash, so tag/blue/page/2 should redirect to tag/blue/page/2/

search performs a MySQL search in "imagename" and "tags"
tag performs a MYSQL query where 50 wallpapers are shown and if necessary shows a pagination (&page=2)
category same as tag

I want all this in one file (or is it better not to?) How should I do this in in PHP?

What happens if someone altered the URL and typed in a wrong ID with a wallpaper, can I throw an error?

correct: /view/50/cool-wallpaper/
incorrect: /view/47/cool-wallpaper/

I know these are different questions, but I hope someone can help...

Thanks in advance for any answers, tips and hints
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 08:43 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.