How can I change my url in php with .htaccess?

0

What is normally done (I use laravel but I want to have the route system with the Php common):

  

www.mipagina.com/index.php?pagina=contacto

As I need it:

  

www.mipagina.com/contacto /

    
asked by MateoAgudelo 25.01.2017 в 20:59
source

3 answers

2

Good afternoon, I recommend using a router like: link It's very easy to configure and you can make all friendly URLs very easy.

As you put in the documentation you will only have to edit the .htaccess and put.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
    
answered by 26.01.2017 в 13:16
0

The topic you are looking for is "htaccess friendly URLs".

It is to create a file .htaccess with the rules of how to interpret the urls, not only works for urls, also to restrict, head, etc.

I leave you some links that can help you study:

Configure: link

Friendly URLs: link

    
answered by 25.01.2017 в 22:11
0

Add these rules to .htaccess :

 RewriteBase /
 RewriteEngine On
 RewriteRule ^$ index.php?/ [QSA,L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule (.*) index.php?pagina=$1 [QSA,L]

Where pagina is the string you will receive for the URL

    
answered by 03.06.2017 в 00:29