Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
RewriteRule no funciona correctamente para subcarpetas

Hay un CMS personalizado y tiene .htaccess .

CMS tiene un sistema ERP externo que llama a los archivos php en la subcarpeta para realizar manipulaciones con los datos. El proveedor realizó una refactorización y eliminó todos los archivos php y redirige todas las llamadas a index.php

En la raíz se ha escrito la regla:

 RewriteRule ^dbeS/(.*)\.php$ dbeS/index.php?id=$1 [QSA,L]

Pero no funciona ahora.

.htaccess funciona correctamente, porque si estoy pegando Test. dentro de <IfModule mod_rewrite.c> , recibo el error 500.

Para NGINX rewrite ^/dbeS/(.*)\.php$ /dbeS/index.php?id=$1 last; - funciona perfectamente para otro cliente. Pero este no quiere migrar de apache a nginx

Ejemplo: en lugar de https://example.com/dbeS/test.php , debe llamarse https://example.com/dbeS/index.php?id=test

Reescribir en .htaccess :

 <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^templates_c/filecache/.*$ - [R=403,NC,L] RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ includes/sitemap.php?datei=$1 [L] RewriteRule ^export/((sitemap_).*\.(xml|txt)(\.gz)?)$ $1 [L] RewriteRule ^asset/(.*)$ includes/libs/minify/?g=$1 [QSA,L] RewriteRule ^static/(.*)$ templates_c/min/$1 [QSA,L] RewriteRule ^dbeS/(.*)\.php$ dbeS/index.php?id=$1 [QSA,L] RewriteRule ^robots.txt$ robots.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/favicon.ico RewriteRule ^. index.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^/favicon.ico RewriteRule ^. favicon-default.ico [L] </IfModule>
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Con sus muestras mostradas, intentos; intente seguir las reglas de htaccess. Asegúrese de borrar la memoria caché de su navegador antes de probar sus URL.

 <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^templates_c/filecache/.*$ - [R=403,NC,L] RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ includes/sitemap.php?datei=$1 [L] RewriteRule ^export/((sitemap_).*\.(xml|txt)(\.gz)?)$ $1 [L] RewriteRule ^asset/(.*)$ includes/libs/minify/?g=$1 [QSA,L] RewriteRule ^static/(.*)$ templates_c/min/$1 [QSA,L] ## Comment following rule as index.php is NOT in dbeS. #####RewriteRule ^dbeS/(.*)\.php$ dbeS/index.php?id=$1 [QSA,L] RewriteRule ^robots.txt$ robots.php [NC,L] ##Newly added rule here for rewrite internal one. RewriteCond %{THE_REQUEST} \s/dbeS/(test)\.php\s [NC] RewriteRule ^ index.php?id=%1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/favicon.ico RewriteRule ^. index.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^/favicon.ico RewriteRule ^. favicon-default.ico [L] </IfModule>


Reglas genéricas: en caso de que su test.php pueda tener cualquier nombre, intente seguir las reglas. Asegúrese de usar las reglas anteriores O las siguientes, una a la vez.

 <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^templates_c/filecache/.*$ - [R=403,NC,L] RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ includes/sitemap.php?datei=$1 [L] RewriteRule ^export/((sitemap_).*\.(xml|txt)(\.gz)?)$ $1 [L] RewriteRule ^asset/(.*)$ includes/libs/minify/?g=$1 [QSA,L] RewriteRule ^static/(.*)$ templates_c/min/$1 [QSA,L] ## Comment following rule as index.php is NOT in dbeS. ######RewriteRule ^dbeS/(.*)\.php$ dbeS/index.php?id=$1 [QSA,L] RewriteRule ^robots.txt$ robots.php [NC,L] ##Newly added rule here for rewrite internal one. RewriteCond %{THE_REQUEST} \s/dbeS/([^.]*)\.php\s [NC] RewriteRule ^ index.php?id=%1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/favicon.ico RewriteRule ^. index.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^/favicon.ico RewriteRule ^. favicon-default.ico [L] </IfModule>
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!