Reputation:
I want to create friendly url from
http://localhost/shop/categories.php?cat=asd --> http://localhost/shop/category/asd
but i always get Object not found
Error 404 error from apache.
.htaccess:
RewriteEngine On
RewriteRule ^.+category/([a-zA-Z]+)$ /shop/categories.php?cat=$1 [QSA,L,NE]
categories.php
<?php
echo $_GET["cat"];
?>
Tested with https://htaccess.madewithlove.be/
Output url: http://localhost/shop/categories.php?cat=asd (this url is working)
I've only 2 files in the folder shop:
Path:
C:\xampp\htdocs\shop
Files:
More info:
Upvotes: 1
Views: 792
Reputation: 19016
You should disable MultiViews
option, which is enabled by default most of the time (see this post and my answer on this topic)
Here is how your /shop/.htaccess
file should look like:
Options -MultiViews
RewriteEngine On
RewriteBase /shop/
RewriteRule ^category/([^/]+)$ categories.php?cat=$1 [L,NE]
Upvotes: 0