Answer the question
In order to leave comments, you need to log in
How to issue 404 if you go to the pages directory, and if not on the page?
Hello! There is a /pages/ directory, the files that are in this directory are opened not as pages/page.php, but as /page . But if you go to /pages/page.php, then the file will open anyway, so that this would not be in htaccess, I added the following:
RedirectMatch 404 ^/pages/.*
But another problem arose.
I want that when there was such an address /ad_pages, then all requests were sent to the pages/index.php file.
To do this, I wanted to write like this:
RewriteRule ^ad_pages$ pages/index.php [L]
But it interferes RedirectMatch 404 ^/pages/.*
How to make them not interfere with each other?
Answer the question
In order to leave comments, you need to log in
/pages/.htaccess
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^ - [R=404,L]
RewriteEngine On
RewriteRule ^ad_pages$ pages/index.php [L]
I have such a cranberry: Redirect 301 /pages/ /404/
But it shows any docks inside the directory ... maybe I just didn’t understand the question ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question