My first blast at mod rewrite. I have this horrible link below whihc takes you to a profile page. On the profile page I fetch the user based on the i parameter.
<a href="engineer-profile.php?country=<?php echo str_replace(' ','-',strtolower($row['country']));?>&area=<?php echo str_replace(' ','-',strtolower($row['area'])); ?>&i=<?php echo $row['id'];?>&name=<?php echo str_replace(' ','-',strtolower($row['name']));?> " class="btn btn-md btn-bitbucket"><i class="fa fa-user"></i> View Profile</a>
I've been trying to make a mod rewrite so the link looks like follows
/uk/southport/23/company-name/
so far I have this in my .htaccess file
RewriteEngine on
RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_]+)/([a-zA-Z_]+)/([a-zA-Z_]+)$ engineer-profile.php?country=$1&area=$2&i=$3&name=$4 [L]
now if I restructure my link so it looks as follows:
<a href="/<?php echo str_replace(' ','-',strtolower($row['country']));?>/<?php echo str_replace(' ','-',strtolower($row['area'])); ?>/<?php echo $row['id'];?>/<?php echo str_replace(' ','-',strtolower($row['name']));?> " class="btn btn-md btn-bitbucket"><i class="fa fa-user"></i> View Profile</a>
I get a page not found error. Ive also tried
<a href="engineer-profile/<?php echo str_replace(' ','-',strtolower($row['country']));?>/<?php echo str_replace(' ','-',strtolower($row['area'])); ?>/<?php echo $row['id'];?>/<?php echo str_replace(' ','-',strtolower($row['name']));?> " class="btn btn-md btn-bitbucket"><i class="fa fa-user"></i> View Profile</a>
Ive also checked mod rewrite is on and it is as it works with basic testing fine. Can someone please explain where I'm going wrong and how I can fix it?
[a-zA-Z_]+).