O
O
Outsider V.2016-01-05 13:48:13
PHP
Outsider V., 2016-01-05 13:48:13

Why is there a redirect to an address with a slash?

Site on MVC, with routing. I request the address in the browser:

audiophilesoft.local/software/audiophiles_software/foobar2000_by_audiophile

The template should work in routing:
'/^\/(\w+)\/(\w+)\/(\w+)$/'
But it doesn't work, because in the $_SERVER array the requested URL for some reason with a slash at the end:
/software/audiophiles_software/foobar2000_by_audiophile/

Moreover, auto-substitution of this slash at the end for some reason does not always work, for a different address, just with a different text at the end - it may not work.
Where did the dog go? It is necessary that addresses with and without a slash are clearly distinguished.
Here is the .htaccess:
Options -Indexes +FollowSymLinks
DirectoryIndex index.php

AddDefaultCharset utf-8

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301]

ErrorDocument 404 /errors/404.html
ErrorDocument 403 /errors/403.html

RewriteCond %{REQUEST_URI} !\/errors\/
# TODO: Remove PHP here - it's only for testing!
RewriteCond %{REQUEST_URI} !\.(js|gif|jpg|png|css|txt|ico|php)$
RewriteRule .* index.php [L]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
romy4, 2016-01-05
@romy4

DirectorySlash must be disabled

A
Andrew, 2016-01-05
@allard

Directory Slash Off

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question