Hello guys I am having issues with one of my sites. Today I deiced to change all my urls to something more presentable. The issue I am having now how to get rid of the spaces. Here is how the link looks right now "http://website.com/repair/iphone%205s"
here is my .htaccess
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^([a-z]+)\/?$ $1.php [NC,L]
RewriteRule ^smartphone/([a-z]+)/?$ devices.php?d=$1 [L]
RewriteRule ^tablet/([a-z]+)/?$ tablet.php?d=$1 [L]
RewriteRule ^repair/([0-9a-zA-Z_\s]+)/?$ repair.php?m=$1 [L]
RewriteRule ^repair/tablet/([0-9a-zA-Z_\s]+)/?$ repairtablet.php?m=$1 [L]
RewriteRule ^repair/ipod/([0-9a-zA-Z_\s]+)/?$ repairipod.php?m=$1 [L]
</IfModule>
The url are build using the model name of each phone I have in my database and they contain spaces so for example iPhone 5s will have the url of "repair/iphone%205s" Here is my php code where I use a _GET statement to return all the repairs for that specif model.
<?php
$model = mysqli_escape_string($con, $_GET['m']);
$modelName = mysqli_query($con,"SELECT
d.id AS 'DeviceID',
d.model AS 'Model',
r.id AS 'RepairID',
r.repair AS 'Repair',
r.price AS 'Price',
r.desc AS 'Desc',
r.active AS 'Active',
r.img AS 'IMG'
FROM `tablets` AS d
LEFT JOIN `tabletrepair` AS r ON
(d.`id` = r.`pid`)
WHERE d.`model` = '$model'
AND r.`active` = 1
");
while($row = mysqli_fetch_array($modelName))
{
echo $row[Model];
echo $row[Desc];
echo $row[Price];
echo $row[IMG];
}
?>
I would like to replace "http://website.com/repair/iphone%205s" to "http://website.com/repair/iphone_5s"
Thanks any help would be gladly appreciated.