Forum Moderators: phranque

Message Too Old, No Replies

simple mod rewrite but trivial

         

varunkrish

12:41 pm on Oct 9, 2005 (gmt 0)

10+ Year Member



i have a page of the format
viewarticle.php?id=10

i am using php to serve content

Here is my .htaccess files content

RewriteEngine On
Options +FollowSymLinks
RewriteRule ^articles/([^_]+).*_([0-9]*).html$ viewarticle.php?id=$2

here is the php code which i use to print the permalink

<p>Permalink : <a href="
<?php echo 'articles'.'/'.$aNAME.'_'.$aid.'.html'?>">Link</a></p>

articles/name-of-article_18.html works

but on that page the permalink is printed as
articles/articles/name-of-article_18.html

if i click this then this also works

dunno whats wrong

seriously puzzled

Birdman

2:55 pm on Oct 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Most likely, you are already in the /articles directory and when you print your link you are using a relative link (ie. no starting slash).

Try printing your link, starting from root (/):

<?php echo '/articles'.'/'.$aNAME.'_'.$aid.'.html'?>">Link</a></p>

varunkrish

5:52 pm on Oct 9, 2005 (gmt 0)

10+ Year Member



thanks a lot....
I figured out the problem now

Great work