Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Mod rewrite help needed
Old 11-26-2005, 05:40 PM Mod rewrite help needed
Skilled Talker

Posts: 59
Trades: 0
Hi,
My website currently generates URL's such as:
http://touringnet.co.uk/?q=reviews&id=45 for a review and:
http://touringnet.co.uk/?q=comments&id=173 for a news article.

It's pretty clear how it works, we've got the page ID and the content ID to fetch from the database.

I am, however, aware that search engines are not too friendly towards an address which uses &id.

For this reason I am attempting to use mod rewrite to correct the URL's so they display along the lines of:
http://touringnet.co.uk/review/reviewid.html
http://touringnet.co.uk/news/newsid.html

So, my code for the .htaccess is:
Quote:
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule /?q=reviews&id=$ /review/([0-9]+)
RewriteRule /?q=comments&id=$ /news/([0-9]+)


However, when I upload this file nothing seems to happen which I don't understand. I've tried many ways and none of them seem to do anything!

Does anybody know what is wrong?
Thanks.
Btcc22 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-26-2005, 09:36 PM
Bompa's Avatar
Extreme Talker

Posts: 225
Location: The Philippine Islands
Trades: 0
RewriteRule /?q=comments&id=$ /news/([0-9]+)

The first parameter is a regular expression, (regex). Regex has characters
that have special meaning. Two such characters are the ? and the $.
The ? in called a quantifier and means 'zero or one'. The $ means 'end
here', so you are looking to match URLs that end with an equal sign.

Firstly, to nullify the special meaning of your ?, precede it with a backslash
like this \?

Next, drop the $ for now.

Now you have RewriteRule /\?q=comments&id=

and my question is how many digits could possibly show up after the
equals sign?


Bompa
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Bompa is offline
Reply With Quote
View Public Profile Visit Bompa's homepage!
 
Old 12-01-2005, 10:06 AM
Skilled Talker

Posts: 59
Trades: 0
Thanks for your reply.
No limit.
Btcc22 is offline
Reply With Quote
View Public Profile
 
Old 12-01-2005, 10:38 AM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
As well, you have to actually write your urls like this...

http://touringnet.co.uk/review/reviewid.html
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 12-01-2005, 04:47 PM
Bompa's Avatar
Extreme Talker

Posts: 225
Location: The Philippine Islands
Trades: 0
Is your database software going to handle queries in another format?

they display along the lines of:
http://touringnet.co.uk/review/reviewid.html
http://touringnet.co.uk/news/newsid.html
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Bompa is offline
Reply With Quote
View Public Profile Visit Bompa's homepage!
 
Reply     « Reply to Mod rewrite help needed
 

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.33862 seconds with 12 queries