D
D
Denis Adamov2019-11-16 06:49:54
htaccess
Denis Adamov, 2019-11-16 06:49:54

Why is a slash added to the end of the url?

Hello, can you please explain why a slash is added to the end of the url?
I have htaccess file which contains code

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !^/userimages/
RewriteRule .* index.php

And also the index.php file, in which, depending on the request, this or that page is connected.
All urls are opened without adding a slash, except for one.
And due to the fact that a slash is added there, all fonts and styles on the page fly off.
How to remove this slash at the end of the url?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-11-16
@dodo512

If, after adding a slash, all fonts and styles on the page disappear, then you need to specify the path to the files from the root of the site. Those. instead of "style.css" put "/style.css". Or explicitly specify the base address for all relative links <base href="http://site.ru/"> htmlbook.ru/html/base
In the Apache settings, DirectorySlash is usually enabled and existing directories are redirected with a slash. Disable this behavior by adding DirectorySlash Offto htaccess.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question