F
F
fantazerno2014-12-08 13:29:35
PHP
fantazerno, 2014-12-08 13:29:35

How to form the page url correctly?

Tell me how to solve the problem correctly using htaccess
There is a site.ru site. You
need to remove Index.php in the address bar for all pages and sections of the site.
But for example, leave it for the site.ru/blog/index.php section.
Thank you in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2014-12-08
@azovl

Excuse me, but leave him a sense? "site.ru/blog/index.php", as a rule, it is removed from visibility, but in fact it is present, the routing is simply prescribed.
.htaccess
mod_rewrite must be enabled in PHP and will then work for PHP versions above 5.2.6.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

For PHP version below 5.2.6:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question