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

Posts: 59
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
 
When You Register, These Ads Go Away!
Old 11-26-2005, 09:36 PM
Bompa's Avatar
Extreme Talker

Posts: 173
Location: The Philippine Islands
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
__________________
Get a Competitive Edge!
SEO BOOT CAMP >> BLOG
Bompa is offline
Reply With Quote
View Public Profile Visit Bompa's homepage!
 
Old 12-01-2005, 10:06 AM
Skilled Talker

Posts: 59
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
Super Moderator

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

http://touringnet.co.uk/review/reviewid.html
Republikin is offline
Reply With Quote
View Public Profile
 
Old 12-01-2005, 04:47 PM
Bompa's Avatar
Extreme Talker

Posts: 173
Location: The Philippine Islands
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
__________________
Get a Competitive Edge!
SEO BOOT CAMP >> BLOG
Bompa is offline
Reply With Quote
View Public Profile Visit Bompa's homepage!
 
Reply     « Reply to Mod rewrite help needed
 

Thread Tools

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

vB 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.13752 seconds with 12 queries