Friendly URL does not load content

Asked

Viewed 175 times

2

Well, I’m here with a friendly url problem, I’m doing the routes through the file .htaccess and take the values by $_GET.Only when I enter the url the content is not loaded, the page is always trying to load and nothing.

htaccess file

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^estabelecimentos\/([a-zA-Z-0-9-_]+)\/ index.php?controller=estabelecimentos&option=tipo&tipo=$1 [QSA,L]
  • There is no PHP error or apache error 500, for example?

  • There is no error in seeing what happens on this link http://sabeonde.pt/estabelecimentos/bars/

1 answer

4


Your page does not load because it gives javascript error. Since your user-friendly URL contains a "subdirectory", the relative paths of your files .js end up being invalid.

You need to add a tag base in the section head of your HTML.

<base href="http://sabeonde.pt/">

This tag will put http://sabeonde.pt/ before each relative URL when loading content.

  • was that corrected, just one question and possible in the url that now looks like this http://sabeonde.pt/estabelecimentos/bars/ ficar so http://sabeonde.pt/bars/

  • @Césarsousa I did not test, but I think simply removing estabelecimentos\ of .htaccess will work.

  • I tried it like you said and it didn’t work

  • @Césarsousa Change the line of RewriteRule for RewriteRule ^([a-zA-Z-0-9-_]+)$ index.php?controller=estabelecimentos&option=tipo&tipo=$1 [L]

  • Friend and even that was worth for your help was precious even

  • I’m here with another problem regarding that line you gave me to trade solved a problem but now I tried to create the same line but for another file but always falls into that rule establishments how can I fix it

  • @Césarsousa This is already a different problem. Create another question and describe it there.

  • I already asked a new question

Show 3 more comments

Browser other questions tagged

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