I tried a few different questions:
- php - .htaccess make URL user friendly for multiple and dynamic parameters
- .htaccess for friendly URL with multiple variables
- User-friendly URLs instead of Query Strings?
The questions above were not useful, so I began to develop an alternative, but my code is returning an 404 error with multiple requests(code1), and with one request worked well(code2) So:
(code1) - Don´t Work - Multiple Resquest (code2) - Work Fine - Single Request
Code1
Options +FollowSymLinks -MultiViews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)$ /~loja/index.php?a=$1&genero=$2&material=$3&cor=$4&tamanho=$5&Ordenacao=$6 [NC,L,QSA] RewriteCond %{THE_REQUEST} ^.*/index\.php RewriteRule ^(.*)index.php$ /~loja/$1/$2/$3/$4/$5/$6 [R=301,L] DirectoryIndex index.php
Now see the Correct Code:
Code2
Options +FollowSymLinks -MultiViews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-zA-Z0-9_-]+)$ /~loja/index.php?a=$1 [NC,L,QSA] RewriteCond %{THE_REQUEST} ^.*/index\.php RewriteRule ^(.*)index.php$ /~loja/$1 [R=301,L] DirectoryIndex index.php
What is wrong with (code1)?