How to make my URL friendlier? [duplicate]

2

I have the following URL:

  

www.site.com.br/www/login.php

And I wanted to leave it like this:

  

www.site.com.br/login

How can I do this through .htaccess?

    
asked by anonymous 18.07.2017 / 21:40

2 answers

0

Hello,

You can use mod_rewrite to do this.

1) create an .htaccess file in the root of your server directory;

2) type RewriteEngine On in the first line of the file.

3) create a rule for URL redirection.

ex: Your URL: link
Desired URL: link

Your file will have the line:
RewriteRule ^/novo$ /site.php?ind=1&cod=novo [NC]

It may be a bit confusing at first, but you can find more information about it here:
link

and here too:
link

    
18.07.2017 / 22:19
0

This rule should resolve:

RewriteEngine ON
RewriteRule ^www/(.*)$ $1 [L,QSA]

"More details can be found" below:

  • The QSA flag informs you that only Query_String can access them.
  • The L last flag) is a flag indicating that the current rule should be applied immediately without regard to other rules (ie, it becomes independent) .

Font

You can test it here .

    
18.07.2017 / 22:28