RewriteEngine OnRewriteRule ^([^/]*)\.html$ /index.php?page=$1 [L]
www.mydomain.com/index.php?page=1
echo $_GET['page'];
$_GET['page']
http://www.mydomain.com/index.php?page=1
<li><a href="index.php?page=<?php echo urlencode($pageid);?>"><?php echo $pageName; ?></a></li>
$idRequest = $_REQUEST['page'];
RewriteEngine OnCheckSpelling OnRewriteRule ^([^/]*)\.html$ /index.php?page=$1 [L]
<li><a href="test/mypage.html"><?php echo $pageName; ?></a></li>
$idRequest = $_REQUEST['page']; // Filter your string, otherwise you'll end up with no databaseecho $idRequest; // This will output 'test/mypage'
SELECT * FROM Menu WHERE PageURL LIKE 'test/mypage' LIMIT 1
but still not working please help me
Additionally, does your server definitely support rewriting?
thank you andy !
here...
I've never been one to get my head around regular expression the first time around
Check this out, seems to cover everything needed
http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html
Is there any errors coming up on your site when you try to access it?
no errors coming up,and i checked the website but how i know that .htaccess work fine !
It should echo out any variables passed to the page if it's working
but url never change to static...
You should be typing the URL you want to rewrite to http://www.mydomain.com/index.php?page=1 not the resulting URL because it's a one-way rewrite process
e.g. load up
http://www.mydomain.com/test/mypage.html
then echo out the $_GET['page'] and you should see 'test/mypage' if it is working correctly
then i get the value by this code
then i use it in SQL syntax
and .htaccess placed next to index page in the root directory of my website and has this code to make easier to read
so please where is the in correct in my whole code , what should i change !
i'm just a beginer in htaccess
Firstly your link should be a link to the 'Friendly' URL. So change:
to
This, based on your rule, should give you something like:
On our sites we save our page url against the page in the database, so at this point my query would be something like