Page 1 of 1
Need help about hiding URL contents in PHP
Posted: Tue Jun 30, 2009 6:03 am
by waseem83
How can i hide query string contents from URL through PHP?.
i.e if i have "
posting.php?mode=post&f=1"
I want to write it as
posting
HOw it can be done in PHP.
KIndly help me for this.
Thank you.
Re: Need help about hiding URL contents in PHP
Posted: Tue Jun 30, 2009 6:10 am
by papa
URL rewrite is your friend. Or POST the url instead of GET.
Re: Need help about hiding URL contents in PHP
Posted: Tue Jun 30, 2009 6:15 am
by waseem83
If i want to have link then after cliking on link the query string will be shown in URL but i dont want it to be shown in URL.
Like if after clicking on link URL is
"
posting.php?mode=post&f=1"
But i want to show it as
"
posting"
How it can be done for link click.. ?
Re: Need help about hiding URL contents in PHP
Posted: Tue Jun 30, 2009 6:17 am
by papa
Re: Need help about hiding URL contents in PHP
Posted: Tue Jun 30, 2009 6:34 am
by BornForCode
Please give also the apache version:
Code: Select all
RewriteEngine On
RewriteRule (.*)\.html $1 [R=301,L]
Or you can use
Code: Select all
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ http://www.domain.com/$1 [R=301,L]
Or (i recommend you this one)
Code: Select all
RewriteEngine on
RewriteCond %{REQUEST_URI} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html [L]
Re: Need help about hiding URL contents in PHP
Posted: Tue Jun 30, 2009 7:11 am
by waseem83
Thank you very much for help.