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

134
Views
htaccess reescribir url con subcarpeta eventual

Tengo urls como esta:

https://mywonderfulsite.com/page

y mi .htaccess lo reescribe como

https://mywonderfulsite.com/index.php?source=page

El .htaccess es el siguiente:

 RewriteEngine on RewriteBase / RewriteRule \.(php)$ - [L] RewriteRule ^index\.html$ - [L] RewriteRule ^favicon\.ico$ - [L] RewriteRule ^custom404\.html$ - [L] RewriteRule ^custom500\.html$ - [L] RewriteRule ^([^/]+)/?$ index.php?source=$1 [L]

Esto falla si la URL contiene una subcarpeta como

https://mywonderfuldomain.com/subfolder/anotherpage

eso debería convertirse

https://mywonderfuldomain.com/index.php?source=/subfolder/anotherpage

Parece que no entiendo cómo manejar esta situación. ¿Como arreglarlo?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

El problema es con el patrón ([^/]+) que coincide con todo menos con / .

Úsalo así:

 RewriteEngine On RewriteRule \.php$ - [L,NC] RewriteRule ^(?:favicon\.ico|(?:index|custom500|custom404)\.html)$ - [L,NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule .+ index.php?source=$0 [L,QSA]
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!