Help with friendly url

Asked

Viewed 31 times

0

I have no knowledge of programming, however I dared to develop a site and I’m having problems so that the url shown in the browser appears in a friendly way and I would like the help of noble programmers. The rules of my . htaccess are as follows:

RewriteCond %{REQUEST_FILENAME} !-f  
RewriteCond %{REQUEST_FILENAME} !-d  
RewriteRule ^(.+)\/(.+)\/?$ proprietario.php?$1nome=$2 [NC,L]  
RewriteRule ^(.+)\/(.+)\/?$ imovel.php?onde=$1&numero=$2 [NC,L]  

I have two files that make a Select in my database, one of them being the immovable.php and the proprietary.php. All of my files are in the public.html folder, including . htaccess and my index.php which upload via the GET method. My index has search forms. That is, what is typed in the form will be the content of the url with the format "friendly". I would like the url display in the browser to be something like http://www.meusite.com/proprietario/a10-participacoes-eireli but even trying several rules with . htaccess the result is always http://www.meusite.com/proprietario.php?nome=a10+participacoes+eireli.
The other case always exhibits something like http://www.meusite.com/imovel.php?onde=01311-000&numero=1000 when I would like it to be displayed http://www.meusite.com/imovel/01311-000/1000. For this case in place of 01311-000 which is received search form could be words instead of numbers and would like it to be displayed as follows http://www.meusite.com/imovel/av-paulista/1000

  • Did you use any CMS (Content Management System) to develop this site? If yes which?

  • I didn’t use it. I just created the php files and put them in the public folder. There are some other image and css folders that are organized within the public as well

  • 1

    If the link above does not resolve, you have many other posts on the site on the subject

  • Bacco, believe me, I’ve been through enough and I couldn’t get an answer to my problem which is apparently simple. However I couldn’t get a solution.

  • 1

    Look a little more, I can say with great peace of mind that what you have to say about PHP friendly URL was already more than sold out here on the site. There is nothing more that can be answered that has not been spoken of here before. If AFTER implementing has some problem that is unique to your case, then just ask a specific question with your code, and describe exactly the part that did not work out, then maybe it fits a specific answer to your situation. From what was currently posted in your question, has everything already.

  • Remember that you can [Dit] the post at any time if you want to be more specific and focus on details that are currently not in the post. If there really is no post after editing that has the way to the solution, obviously the community can reopen (recalling that there are 229 results just for the research I did, which was even a little too restrictive - trying other terms, maybe find even more specific things).

  • 1

    A tip that may help your specific case in the search (and that also has on the site, I’m just repeating to try to help) is that you will probably make a redirect, for example points your form to "search.php" that redirects to "/search/word1-word2-word3" to avoid having to use JS in the form. Probably your difficulty lies in the fact that GET always passes the URL in the normal way ? parameters, but then PHP cannot intercept. For this the redirect, which is transparent to the end user.

  • This one has to do with what I commented a little: https://answall.com/search?q=.htaccess+query+string - not that it cannot be done by . htaccess, but I think with PHP will make your life easier.

  • Ok. I will review some issues again including your suggestion. I may have missed something. Thanks

  • Think about the redirect, or search for a . htaccess that is specific to query string, qq thing comment here. I’m taking another peek if I can find one more specific as well. Depending on what, we can think about revising your text to focus on this specific point of the search, to think about reopening.

  • 1

    One thing that can help is to simplify the text, more in the format "what tried" and "what happened instead of what expected", not to fall for the "do it for me", which really doesn’t work out very well. Perhaps a little more detail of your form’s criteria (pq one of them goes to /immobile but the other goes to /proprietary? are different Forms, will have to take from select, or what? what are the fields of the form, if this is the last case - select is the first place after the bar?). Are examples, of course.

Show 6 more comments
No answers

Browser other questions tagged

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