Creating Friendly URL I don’t know how to do

Asked

Viewed 46 times

0

I have a website and index.php and where to register and login. Watch some videos lessons but all of them do the explanation using index as an example so you can pick up the url and work it with php

RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1

I have to remove all content from the index and put it in a new file so I can leave the index only for url checks????????

another doubt is that if I don’t want to do it the way above I can choose to keep rewriting what the user types and where it goes only with htaccess? Is that right? Or is there another way?

example:

RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^login(.*)$ login.php

1 answer

0

I didn’t understand your question very well, but.

1 - create a file. htaccess.

2 - Do not touch the index with htaccess since it is the main page.

3 - to modify the URL do the following.

RewriteEngine On
RewriteBase /
RewriteRule ^Nome-da-pagina-que-vc-quer?$ Nome-da-pagina-que-vc-quer-mudar.php[QSA,L,NC]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

Browser other questions tagged

You are not signed in. Login or sign up in order to post.