Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

143
Vistas
Getting file and folder issues using htaccess file in PHP

I am working for a blog system using PHP PDO. I have created a post.php page in my root folder. In the same root, I have an Admin folder. I am getting posts from databases like -

example.com/cat_slug/post_slug 

i.e

example.com/php/how-to-learn-php 

As you can see there is no post keyword in the URL because of the .htaccess file.

RewriteEngine On  
 RewriteRule ^([^/]*)/([^/]*)$ post.php?cat=$1&postSlug=$2 [L]

It's correct according to my need but in the same folder, I have the Admin folder(where post.php is located ). The Admin folder contains folders and files. Now, when I open the Admin folder it's going to post.php

like -

example.com/Admin 

and it's going to example.com/Admin and output - undefine - slug ad cat. I want to that when I visit the Admin folder it should open Admin files not redirect to the post.php file. I have many folders in my root same as Admin. All are going to post.php execution.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Try something like this:

RewriteEngine On  

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/([^/]*)$ post.php?cat=$1&postSlug=$2 [L]
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda