Here is my PHP code (qs.php). This file contains pretty url links.
<html>
<head></head>
<body>
<?php
$file = 'qs1';
$id = '12345678';
$complete_url = $file."/".$id;
?>
<a href ="<?php echo $complete_url;?>"> This is a test link </a>
</body></html>
This link shows the link - http://localhost/qs1/12345678
QS1 is a php file (qs1.php).
Below is the htaccess file.
RewriteEngine On
RewriteBase /
RewriteRule ^([^/]+)/(\d+)/([^/]+)$ $qs1.php?var1=$2 [NC,L]
In the qs1.php file, I get a query string var1on$_GET['var1']
I want the link to be accessible using this URL http://localhost/qs1/12345678. and if the user puts a slash at the end, like this one http://localhost/qs1/12345678/, then the page redirects itself to this one http://localhost/qs1/12345678.
I am currently getting 404 error opening this http://localhost/qs1/12345678/
Thank you for your comment.
source
share