I am coding website in PHP
And My links are :-
http://example.com/science.php?category=alien&title=Find+UFO+Just+over+your+head+by+clicking+here
Now, I want to show url in my view source as :-
http://example.com/science.php/alien/Find+UFO+Just+over+your+head+by+clicking+here
Also i want this as working link :-
From .htaccess [with the help of generateit.net > mod_rewrite generator] here is the code:-
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /science.php?category=$1&title=$2 [L]
Now what do i need to do in PHP , to make this URL Valid.
Do i need to write below link :-
<a href="http://example.com/science.php?category=<?php echo $rows['category'] ?>&title=<?php echo htmlentities($rows['title']); ?>" > <?php echo $rows['title'] ?></a>
in my code or do i need to write :-
<a href="http://example.com/science.php/<?php echo $rows['category'] ?>/<?php echo htmlentities($rows['title']); ?>" > <?php echo $rows['title'] ?></a>
or some function to make above url.
Thank you ! I am hunting for this knowledge since long time.
Thanks once again
Actually, there is no need for any change from PHP Side, because php will receive request after translated by .httaccess file.
Now i think there is something wrong with your .httaccess conditions, please try below code:
and after save, try link below
I hope this help