I want all pages to redirect properly, the web has different levels of folders and category pages and product or service details, I attach code as I have it in the .htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
#Pagina de servicio en carpeta raíz, redirecciona bien!!
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)$ experiencia.php?xs=$1&sv=$2 [NC,L]
#Página de detalle servicio en directorio raíz, redirecciona bien!!
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)$ servicio.php?srv=$1 [NC,L]
#Página en carpeta /tienda-de-regalos/ (categorías productos),redirecciona mal, lo hace a la página experiencia en el directorio raíz
RewriteRule ^tienda-de-regalos/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ tienda-de-regalos/category.php?ttp=$1 [QSA,L]
#También debo adicionar re dirección a pagina de detalle productos, página en carpeta /tienda-de-regalos/
RewriteRule ^tienda-de-regalos/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ tienda-de-regalos/product.php?ttp=$1 [QSA,L]
You have a problem with the indicator
L
ofRewriteRule
:In Spanish:
So the URLs that fail you are being treated by the first two rules and are not parsed by the last two.
If you don't want other rules to modify the last two, you should put them first (in order of preference):
NOTE: Note that the last two rules (now the first) are EXACTLY the same, so only the first will be executed effectively, the second will never be fulfilled. You should use some text or pattern that uniquely identifies them.