Forum Moderators: phranque
I am having problem creating friendly urls.Though i am able to remove .php extension from my file using apache forcetype through .htaccess file but i am facing problem of how to use the path_info
I want my url to look like this when moved to next stage
www.example.com/soccer/page1
but instead of this it is showing
www.example.com/soccer?id=1
My 2 files look like this.
code of .htaccess is as follows -
<Files soccer>
ForceType application/x-httpd-php
</Files>
code of soccer file is as follows
if($id==1)
{
echo "bla bla";
}
if($id==2)
{
echo "blee blee";
}
echo "<p> <a href=$PHP_SELF?id=1>1</a>
<p> <a href=$PHP_SELF?id=2>2</a>";
what should i do so that '?' is removed and it should look like
www.example.com/soccer/page1
Thanks for support and valuable time
HS
echo "<p> <a href=soccer/page1>1</a>
<p> <a href=soccer/page2>2</a>";
THEN, you use .htaccess to rewrite these urls to a form that php will understand eg,
something like:
RewriteEngine On
RewriteRule ^soccer/page(.*)$ yourfile.php?id=$1 [L]
At least, that is the way I do it.
I don't think you need ForceType at all, because php is always sent as html.
Take it slowly and carefully and work on a test directory, not your live site.