I'm working on my .htaccess for a school project. I'm trying to rewrite my URL so it looks nicer. That is, you have localhost/website/public/profile/alex
and not localhost/website/public/profile/index.php?username=alex
.
I have this in my .htaccess file:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^localhost/website/ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^public/profile/?(.*)$ public/profile/index.php?username=$1 [QSA,L]
Why is this not working? How can I make sure it will work?
Here is my file structure:
website/
application/
public/
css/
font/
img/
js/
login/
player/
playlist/
profile/
const.php
index.php
register/
const.php
testplayer.php
.htaccess
website.sql
index.php
README.md