I
I
Ivan2018-07-26 07:58:09
htaccess
Ivan, 2018-07-26 07:58:09

How to set .htaccess to specific condition?

My .htaccess in cms

<IfModule mod_rewrite.c>

# Enable rewrite rules
RewriteEngine on

# Base directory
RewriteBase /

# Deny direct access to .txt files
RewriteRule ^content/(.*)\.txt$ - [R=404,L]

# All URL process by index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php [PT,L]

## Application Handler
 #  RewriteCond %{REQUEST_FILENAME} !-d
 #  RewriteCond %{REQUEST_FILENAME} !-f
 #  RewriteRule ^(.*)?$ my.php [QSA,NC,L]

</IfModule>

I implemented my script in cms, I need to redirect to the
my.php file Above in the code, I have a commented , a working example, but if you uncomment it and leave the rules above - it does not work. I tried a bunch of options, either the site or my script works, they don’t want to work together. Please help create the correct .htaccess Thanks!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2018-07-26
@9StarRu

<IfModule mod_rewrite.c>

# Enable rewrite rules
RewriteEngine on

# Base directory
RewriteBase /

# Deny direct access to .txt files
RewriteRule ^content/(.*)\.txt$ - [R=404,L]

RewriteRule ^\d+$ my.php [L]

# All URL process by index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php [PT,L]

</IfModule>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question