htaccess restrictions

Asked

Viewed 103 times

6

I’d like to clean mine url so that the user does not see it,I searched on the internet but I could not make it work.

I’ve already activated the bookstores in my wamp but I couldn’t make it work properly.

www.meusite.com.br/index.php? p=contact&subject=work

I need to maintain the whole structure but I would like the customer just view:

www.meusite.com.br/contact/work

How can I do?

I performed some tests and arrived at the following source:

.htaccess

#reescrita
RewriteRule ^([a-z,0-9,A-Z,_-]+)\/([a-z,0-9,A-Z,_-]+)\/$ index.php?p=$1&assunto=$2 [NC,L]

html

<a href="pagina/teste/">action</a>
<a href="pagina2/teste2/">action2</a>

But when clicking on the second link option it does not clear url, just increments presenting error, how to fix?

www.pagina.com.br/pagina2/teste2/page/test/

  • 1

    This is a friendly url, take a look at: http://blog.thiagobelem.net/learning-urls-friends-com-complex/ and http://wbruno.com.br/php/desmistificando-urls-friends-com-php-e-htaccessapache/

  • 1

    Beware of unnecessary editing acceptances personal... in case of doubt, there’s the jump button in the analysis queue. that first edition hardly changed anything from the question.

  • 1

    @Chun I approved, but I went back and edited. Vacilo meo.

1 answer

2


The problem is that your href is thus (concerning the path current):

pagina/teste/

Should be like this:

/pagina/teste/
  • vlw, it worked. now I need to know how to hide a folder inside the url.

  • @Brunocoió when you speak of "hide inside the url a folder", you mean - hide the files inside it so that the user does not access the 'skeleton', ie the sub-folders of this file?

  • for example, hide the '/test' folder from the link, or even a record 'id=12'

Browser other questions tagged

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