FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


.htaccess (Mod Rewrites/Regex)





jeremyyak
Ok, right now, this is one of the lines in my .htaccess file:

Code:
RewriteRule ^article/([0-9]+)$ /index.php?id=article&article_id=$1 [nc,L]


This renders http://mysite.com/article/1 ... But I want a trailing slash like this http://mysite.com/article/1/.

I have been trying for awhile to fix the problem..but I can't. Any help?
~Jeremy~
eepman
Try
Code:

RewriteRule ^article/([0-9]+)/?$ /index.php?id=article&article_id=$1 [nc,L]


The question mark tells it that the preceding can be there 0 or 1 times. This worked locally for me, I hope it does for you.
jeremyyak
No luck Confused
Hmm, anyone else have a solution?
~Jeremy~
Stubru Freak
jeremyyak wrote:
No luck Confused
Hmm, anyone else have a solution?
~Jeremy~


What are you trying to accomplish? If you insert the code by eepman, then try to go to http://yoursite.com/article/1/, doesn't it work?
It seems like you try to rewrite something to http://yoursite.com/article/1/ in the address bar of the user, is that what you want?
deepak
Try this:
Code:

RewriteEngine On
RewriteRule ^article/(.*)$ /index.php?id=article&article_id=$1
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.