1

I'm new in the world of .htaccess and I have a problem. I searched in google how to redirect always to a file, like wordpress do it, and I found this:

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /demo/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /demo/index.php [L] </IfModule> 

I tested this and it works but I want to ignore the subfolders and redirect like it does when you request a folder which doesn't exist. Does anyone how to ignore all the subfolders, and redirect without changing the URL?

1 Answer 1

1

Remove the second RewriteCond which checks if directory doesn't exist !-d

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /demo/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . /demo/index.php [L] </IfModule> 
Sign up to request clarification or add additional context in comments.

Comments