Hello all
I have been trying to generate SEO friendly URL in my project.
I had succeeded in single pages Like about.php, contact.php becomes about, contact.
But where i send variables in the url, it doesn’t work out.
It means www.abc.com/admin/add-city.php?edt=3
I had list-city.php page where all cities are listed, if user wants to edit any one , it will click and user will be directed to add-city.php page for editing.
My code for list-city.php is
<?php
$sn = 1;
$city1 = mysqli_query($conn, "SELECT * FROM mCity WHERE is_delete = 'No' ORDER BY cityname ASC");
while($city2 = mysqli_fetch_array($city1))
{
?>
<tr>
<td><?php echo $sn; ?></td>
<td><?php echo ucwords($city2['cityName']); ?></td>
<td>
<!--<a href="add-city.php?edt=<?php echo $city2['cityid']; ?>" class="action-icon" title="Edit"> <i class="mdi mdi-square-edit-outline text-success"></i></a>-->
<a href="add-city/<?php echo $city2['cityid']; ?>" class="action-icon" title="Edit"> <i class="mdi mdi-square-edit-outline text-success"></i></a>
</td>
</tr>
<?php
$sn++;
}
?>
My htaccess code looks like
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^add-city/([0-9]+)$ list-city.php?edt=$1
Please look into and guide.
Regards
Himanshoo