Understanding .htaccess

I am trying to change my url type with .htaccess, but I have a few problems. I tried several online tools, but they do not even work for me. So here is what I am trying to do;

I have type pages http://mydomain.com/profile.php?u=newuser, and I want to do this: http://mydomain.com/newuserbut so far I have not been able to achieve this.

That's what I tried;

Options +FollowSymLinks
RewriteEngine on

RewriteRule (.*) profile.php?u=$1

After making changes to .htaccess, should I also make any changes to my php files? In addition, when I tried to open it, http://mydomain.com/newuserI noticed that some of my images on the page disappear, what could be the reason for this? Thank you very much!

+3
source share
2 answers

, URL- profile.php, , , /images/logo.jpg.

, ? - :

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) profile.php?u=$1

'RewriteCond' rewriteengine URL-, , .

, /profile/prefix URL- :

Options +FollowSymLinks
RewriteEngine on
RewriteRule profile/(.*) profile.php?u=$1

, ; , "profile.php" - , URL- .

+2

, profile.php(. *). , ..

, "" :

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
+2

All Articles