A
A
alaskafx2021-03-31 22:08:46
PHP
alaskafx, 2021-03-31 22:08:46

How to make this link work?

I have a miracle code.
For starters:

.htaccess:

RewriteEngine on
RewriteCond  %{DOCUMENT_ROOT}/lk/$1 -f
RewriteRule ^(.*)$ lk/$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php


There is index.html:
<li><a  href="/lk.php" class="lk">ЛИЧНЫЙ КАБИНЕТ</a></li>


The essence of "this" is that I have, as it were, a folder "lk", well, there is a file "lk.php" in it.
In .htaccess, it is done so that .php is removed at the end of the url, and so that the folder is not displayed.
But, this is how it happens. that if you write as above in HTML, then everything works fine, except for the url that displays at the end of .php.
If you remove this miracle .php in href and run it, it knocks out the folder in which I have to select the file: D

(I hope I explained it clearly).

You need to make sure that the folder is not displayed, and that .php is not displayed at the end of the url.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Icantdothis, 2021-04-01
@Icantdothis

Haven't tried it, but still.
If we talk about your method, I would try to do it in the "collective farm" way.
So, xref throws you to a php file, which is located in the same folder as lk.php, and this file should redirect you to your lk.php, but without the php extension.
Try)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question