C
C
capaw2020-09-19 08:03:28
Apache HTTP Server
capaw, 2020-09-19 08:03:28

How to change the appearance of links through .htaccess?

Good afternoon! Google did not help solve the issue. There is a .htaccess file like this:

RewriteEngine On
RewriteRule ^index\.php$ / [R=301,L]
RewriteRule ^(.*)/index\.php$ /$1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [L]
RewriteRule ^category/([0-9]+) category.php?id=$1 [L]

ErrorDocument 404 /404.php Change

links like https://mysite.rf/category.php?id=1 to https://mysite.rf/category/1. But with such rules in .htaccess, by default the link remains as in the first option. The second option can only be obtained by entering the link into the address bar manually. Tried different options from Google, but nothing helped. Please tell me how to solve

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-09-19
@FanatPHP

mod_rewrite (which newbies mistakenly call .htaccess) does not change links . it can only automatically redirect to another when requesting a certain link. but it cannot change anything in the site code.
to change the links on the site, they must be... changed on the site!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question