K
K
KeySh1e2021-01-18 01:18:32
htaccess
KeySh1e, 2021-01-18 01:18:32

CNC Links for php?

Hello, I'm trying to make CNC links for a website. I climbed the entire Internet, and tried many options, none of them helped.
From this link mydomain.com/thread.php?t=21 , you need to make mydomain.com/thread/21 or mydomain.com/thread/t/21 .
Tried to do through htacces
Thanks in advance for your help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2021-01-18
@SteweX

RewriteCond %{QUERY_STRING} (?:^|&)t\=21(?:$|&)
RewriteRule ^mydomain\.com/thread\.php$ /mydomain.com/thread/21? [L,R=301]

This is straightforward if you need to redirect to make
GET not part of the URL and stand out separately. via %{QUERY_STRING}
so you should have done it this way.
index.php?route=%1
%1 is $1 but if you allocate in RewriteCond
As for CNC
RewriteEngine On
Options +FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/index.php$
RewriteRule ^(.*)$ /index.php [L]

Then I would add another negation of the index itself so as not to create a cycle.
ps
?:ignore this group is not a mandatory rule

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question