Htaccess accept bar at the end

0

I would like to know how do I make my URL accept bar at the end / , because in the way that this, when I add bar, the images and the css are based on the URL with the parameter, generating error in loading. >

http://localhost/pagina/index.php?page=minha-ideia
http://localhost/minha-ideia
http://localhost/minha-ideia/

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?page=$1
    RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?page=$1
</IfModule>

Finally, I have questions about how I should get this URL:

$_GET['page']

Should I validate this URL, or in the manner described, is any error directed to page 404?

http://localhost/minha-idééééé
    
asked by anonymous 11.09.2016 / 15:46

1 answer

1

In order for the images to work correctly you should modify your HTML code that should look like this:

<img src='nome-da-pasta/imagem.jpg' alt='*'/>
ou
<img src='http://site.com/nome-da-pasta/imagem.jpg' alt='*'/>

You should leave this way, including the toolbar:

<img src='/nome-da-pasta/imagem.jpg' alt='*'/>

In both image and links, leave the bar as in the example above that will work!

    
11.09.2016 / 18:58