This is my non-friendly URL: localhost/website/users/?name=UserA
Now, i tried to create a friendly URL using .htaccess file.
This is everything in my .htaccess file:
ErrorDocument 404 /movies/error404.html #For Error 404
RewriteEngine On
RewriteRule /website/users/(.*)$ /website/users/name=$1
Now, When I open localhost/website/users/UserA
it opens error 404 page.
Yes mod_rewrite is enabled
Try this in your .htaccess
file
#Options +FollowSymlinks
RewriteEngine On
RewriteRule ^users/([0-9A-Za-z]+)/?$ users/index.php?name=$1 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
ErrorDocument 404 http://localhost/movies/error404.html
In this cause the .htaccess
file would be placed under the website
directory root
Note: The requests are going to index.php
file which is under the users
directory if you have another filename then replace it with that one