Reputation: 2189
I am trying to create an .htaccess
script for my site URL but it is not working...
I have a root (WAMP Server) folder where I have my site folder, Folders
where I have the index.php. In it I also have folder A
, B
, and C
.
Folder A
has abc.php
and it has a link, <a href = 'http://localhost/Folders/B/users.php?user=name'>View User</a>
. I want my URL to show up
like this: http://localhost/Folders/B/name
but nothing is happening.
The .htaccess
file is stored in Folders
.
Apache code:
RewriteEngine on
RewriteBase /Folders/B/
RewriteRule ^([a-zA-Z_]+)$ /Folders/B/users.php?user=$1 [L]
Thank you in advance.
Upvotes: 1
Views: 51
Reputation: 785128
Try this code:
RewriteEngine on
RewriteBase /Folders/B/
RewriteCond %{THE_REQUEST} /users\.php\?user=([^\s&]+) [NC]
RewriteRule ^ %1? [R=302,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ users.php?user=$1 [L,QSA]
Upvotes: 1