1
I have this url on my website
categorias.php?id_categoria=1
I want to make a rule to stay
produtos/nome-categoria
Since the category name I’m already pulling from the bank with php
my . htacsess is so with a rule already made for the home page
<IfModule mod_rewrite.c>
RewriteEngine On
#aqui criamos uma condição para que os arquivos sejam ignorados nas regras abaixo
RewriteCond %{REQUEST_FILENAME} !-f
#aqui criamos uma condição para que diretórios sejam ignorados nas regras abaixo
RewriteCond %{REQUEST_FILENAME} !-d
#aqui definimos onde começa a base das regras
#fix rules
RewriteRule ^pagina-inicial/?$ index.php [NC,L]
</IfModule>
According to his code, I could understand that he goes for the ID category, which must be an integer number. You must adapt the code if you want to search by category name.
– Carlos Andrade
returned Error 404. I changed php to fetch skin Name. products/name-category
– Wagner Martins Bodyboard
Error 404 means the url was not found. Try to check if the path is correct.
– Carlos Andrade
You may have to restart the Apache service
– Carlos Andrade
do i access the address like this categories.php? id_categoria=1
– Wagner Martins Bodyboard
Then it would look like this:
produtos/1
– Carlos Andrade
when I place Rewriterule products/(.*)$ /categories.php? id_categoria=$1 [NC,L] returns ero 404
– Wagner Martins Bodyboard
products/1 tbm returned the 404
– Wagner Martins Bodyboard
Let’s go continue this discussion in chat.
– Carlos Andrade
face soh one more thing if I have categories.php? id_category=1&name_category=name-category and want to access it like this categories/name-category ?
– Wagner Martins Bodyboard
Wagner, I think you should create another topic, because it already escapes from the original question and you may have negative points so.
– Carlos Andrade