User-friendly URL and default URL php with parameters

Asked

Viewed 142 times

0

I have a question and I believe you can help me.

I want to leave running the two URL systems on my site, I want to put friendly on some pages and leave the default shape on another.

pagina.php?nome=Bruno

Would anyone know how to set up .htaccess for him to accept the two standards ?

I’m already hiding the . php with this code

RewriteEngine on<br>
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

1 answer

0

You can use

  RewriteEngine On
  RewriteRule ^nome/([^/]*)$ /?nome=$1 [L]

This will return a page of this type

pagina.php/nome/Bruno

If you want to omit the /name/ you can use

RewriteEngine On
RewriteRule ^([^/]*)$ /?nome=$1 [L]

I hope I’ve helped.

  • Hello Bruno, thanks for the reply, the L flag will let the other url I didn’t turn into friendly work ? Thanks

  • Today I use the following user way? user=12 and I want to leave user/12 or user/nameserver but I want to continue using on the other pages the old way, and without displaying the . php

Browser other questions tagged

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