How to make Friendly Urls instagram style

Asked

Viewed 91 times

1

I made a FRIENDLY URL only it’s like this: I wanted the link to be like this: www.site.com/usuario1/, I mean, when the guy puts www.site.com/usuario1 it was redirected to the www.site.com/usuario1/.

Man .htaccess is this and only works if put without the bar at the end www.site.com/usuario1

Complement this htaccess to the above example?

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) profile.php?id=$1/ [QSA,L]

Yes I want you to have the / at the end of the user name, I modified the . htaccess for this as you were saying for yourselves: Rewriteengine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\..+$
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) /site/profile.php?id=$1/ [R=301,L]

worked until the redirect, now the links are: site.com/profile.php? id=User1/ is that how I want to site.com/User1/, has redirecting worked now only part of profile.php? id=User 1 went wrong.

  • @Diegof does not think it is duplicated, the problem is not how to make a friendly URL but when the user puts a bar at the end.

  • 1

    http://answall.com/questions/114168/colocar-barra-no-final-da-url-com-htaccess

  • 1

    @Gleyson if your question is not answered by any of the indicated links, edit it explaining what you need different, and what did not work in the answers indicated for your case (but first check here: http://answall.com/questions/tagged/htaccess which has a lot of questions about . htaccess and "friendly URL' already answered on the site).

  • @Bacco I edited added information.

  • Since my closing vote is instantaneous, I voted to reopen, but I still think a careful reading of the recommended links would solve it. It would be nice to see the Rewrite syntax and adjust according to the documentation.

No answers

Browser other questions tagged

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