P
P
pavlyutkinartem2016-04-05 10:26:53
htaccess
pavlyutkinartem, 2016-04-05 10:26:53

How to modify .htaccess?


RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} (.*)
RewriteCond %{REQUEST_URI} /$ [NC]
RewriteRule ^(.*)(/)$ $1 [L,R=301]
RewriteCond %{THE_REQUEST} ^[AZ] {3,9}\ /([^.]+)\.php\ HTTP
RewriteRule ^([^.]+)\.php$ amocrm.site.ru/$1 [R=301,L]
RewriteCond %{REQUEST_URI } !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.php [L]
RewriteEngine on
ErrorDocument 404 /404
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} !^amocrm.site\.ru$ [NC]
RewriteRule ^(.*)$ amocrm.site.ru/$1 [R=301,L]
I have a website.
At the root are the php files:
- botox.php
- index.php
This .htaccess makes it so that the *.php extension is removed,
and the link looks not
site.ru/botox.php
but
site.ru/botox
Now what's the problem: these *.php are removed from all files with this extension, you need to make sure that ".php" is removed only for
botox.php, index.php files

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2016-04-05
@shambler81

Use denial
but in general you are too smart.

RewriteCond %{REQUEST_METHOD} =GET
   # Выявляем GET запрос в URL (не POST).
RewriteCond %{REQUEST_URI} ^(.*)/(botox|index)\.php$
   # URL cодержит index.php в конце.
RewriteRule ^(.*)$ %1/ [R=301,L]
   # Удалить botox  или index.php из URL.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question