R
R
Roman Zakharov2011-12-09 09:55:36
htaccess
Roman Zakharov, 2011-12-09 09:55:36

Folder instead of DB query?

Hello, tell me with htaccess.

RewriteEngine On<br/>
RewriteCond %{REQUEST_FILENAME} -d [OR]<br/>
RewriteCond %{REQUEST_FILENAME} -s<br/>
RewriteRule ^.*$ - [L]<br/>
RewriteRule (.*)$ index.php?%{QUERY_STRING}<br/>

There is a core folder and there is a page called core in the database The
request looks like this: site.ru/core
How to disable access to folders, and send the entire request to index.php and process it there

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Zakharov, 2011-12-09
@Caman

Replaced with: Earned.
RewriteEngine On
RewriteCond %{REQUEST_URI} -d [OR]
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^.*$ - [L]
RewriteRule (.*)$ index.php?%{QUERY_STRING}

A
Anatoly, 2011-12-09
@taliban

Alternatively, you can do it differently:


RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php

This condition redirects _everything_ that does not have a valid extension to index.php. Thus, by default, everything is prohibited and is transferred to the index, and only the one that you explicitly specify will come out of the static.

E
Evengard, 2011-12-09
@Evengard

Try removing the second and third lines. All that remains is:
RewriteEngine On
RewriteRule ^.*$ - [L]
RewriteRule (.*)$ index.php?%{QUERY_STRING}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question