.htaccess does not work

Asked

Viewed 1,113 times

0

Hello, I already use these rules. htaccess and never gave me problem, so much so that use in other providers currently, I wonder if the version of apache or php on the hosting server hinders the execution of Rules.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteRule ^produto(|/)$ produto.php
RewriteRule ^produto/(.*)$ produto.php/$1

ErrorDocument 403 //403.php
ErrorDocument 404 //404.php
ErrorDocument 500 //500.php

The PHP version is 5.5, the provider does not access the apache version, currently runs on Linux 5.2. The Hosting Site is the Locaweb.

  • Have you tried to change produto.php/$1 for produto.php?/$1?

  • Yeah, it didn’t work.

  • Then make the first editions: // are not valid comments in Apache configuration files. ErrorDocument precise second parameter: ErrorDocument <3-digit-code> <action>

1 answer

0


As I was not able to fix the problem with the solution that works on my server, I had to change the code to fetch the data in the database, so I changed to a GET on the page and added a foreach and modified . htaccess.

.htaccess stayed:

RewriteRule ^produto(|/)$ produto.php?/id=$1
RewriteRule ^produto/(.*)$ produto.php?id=$1

the page stayed:

$prod = $_GET['id'];
$muda_path = explode('/', $prod);
foreach($muda_path as $produto){...}

Browser other questions tagged

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