A
A
Alya Caribbean2019-01-10 22:24:30
htaccess
Alya Caribbean, 2019-01-10 22:24:30

How to redirect htaccess of all .html files to one php file?

Help me figure it out, please.
I do a redirect with a get parameter (it works), I try to add to this code a redirect of all files ending in .html to the same test.php (without a get parameter), but it does not work.
Here is the working code:

RewriteEngine On
RewriteRule ([a-zA-Z0-9_-]+)$ test.php?ticket=$1 [QSA]
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule . test.php [L]

I tried to solve it even with a simple 301 redirect (there are a limited number of files, they will not be added) - but even it does not work. Gives the content of the html file, but it shouldn't.
Help me figure it out please!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Dart, 2019-01-10
@gobananas

Let's say:

RewriteEngine On  
RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f  
RewriteRule ^(.*)$ ./test.php?route=$1 [QSA]

Catch parameters in ['route']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question