K
K
Konstantin Khairov2016-06-16 16:18:31
PHP
Konstantin Khairov, 2016-06-16 16:18:31

How to change the appearance of a link using .htaccess?

Hello, I've run into this problem. I can't change the look of the link through htaccess. There is such a link
sitename.ru/telegram/tg.php?user=kaylos
I take a variable from user and retrieve data from the database and generate rss , so I want to know how to do it. But what would the type of link be like this?
sitename.ru/telegram/kaylos
Thanks in advance for your help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2016-06-27
@shambler81

You have an error, the get request is not part of the url.
You need a two-level construction with a rewrite cond.
In short, here is
https://donatstudios.com/RewriteRule_Generator
Don't forget to mark the answer as solved ;)

I
imhuman, 2016-06-16
@imhuman

RewriteRule ^telegram/([a-zA-Z-_0-9]*)$ telegram/tg.php?user=$1 [L,QSA]
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^telegram/( [a-zA-Z-_0-9]*)$ / telegram/tg.php?user=$1 [L,QSA]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question