LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-10-2009, 07:21 PM   #1
delmoras
LQ Newbie
 
Registered: Nov 2005
Posts: 18

Rep: Reputation: 0
mod_rewrite


Hello I am using mod_rewrite for making my urls user friendier. I have the following issue :

original url : www.sport.com/history.php?team=celtics
wanted url : www.sport.com/team/celtics

1. RewriteRule ^team/([^/\.]+)/?$ /history.php?team=$1 [QSA,L,NC]

the above statement works fine but i want to replace the spaces of a folder with hiphens so to a url like the one below I won't have any issues with the browser:

original url : www.sport.com/history.php?team=boston celtics
wanted url : www.sport.com/team/boston-celtics


any help ?

Thank you,
John
 
Old 01-12-2009, 12:16 PM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,261

Rep: Reputation: 297Reputation: 297Reputation: 297
Hi

This is not tested, but I think it might work:

RewriteRule ^team/([^/\.-]+)-([^/\.-]+)/?$ /history.php?team=$1+$2 [QSA,L,NC]

I don't understand the last /? characters, but if it worked, I guess you should leave it as it is.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
mod_rewrite basarab1310 Linux - Newbie 1 11-06-2008 08:57 AM
Help with mod_rewrite MicahCarrick Linux - Software 3 05-23-2007 09:09 PM
mod_rewrite mr_dizzle Linux - General 1 02-02-2006 08:32 PM
Apache and mod_rewrite notsoevil Linux - General 0 01-23-2002 02:39 PM


All times are GMT -5. The time now is 10:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration