E
E
Evgeny Konkin2019-12-10 23:45:39
PHP
Evgeny Konkin, 2019-12-10 23:45:39

Getting an empty GET .htaccess?

Hello!
I can't figure out why I'm getting an empty GET? I seem to be doing everything right!
I get all the parameters on index.php, but when I go to channel.php, the page opens at this link
localhost:8888/channel/146
, everything is fine, but I get an empty GET?
Of course, if you open localhost:8888/channel.php?id=146
, then everything is fine, I get GET.
Please help
Here is my .htaccess

# устанавлиет кодировку
AddDefaultCharset utf-8

# указывается порядок загрузки типов индексного файла
# лежащих в корне каталога
DirectoryIndex index.php index.html index.htm index.shtml

#
#php_value session.gc_maxlifetime 3600

# если каталог является ссылкой
Options +FollowSymLinks

# включаем mod_rewrite процесс преобразования ссылок
RewriteEngine On
RewriteBase /

# редирект с www.site.ru на site.ru
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

# убираем последний слеш
RewriteRule ^(.*)/$ /$1 [L,R=301]

# если нет такой папки/каталога
RewriteCond %{REQUEST_FILENAME} !-d 
# если нет такого файла
RewriteCond %{REQUEST_FILENAME}\.php -f

RewriteRule ^(.*)$ $1.php [QSA,L]

# Преобразования

# CHANNEL.PHP
# /channel/146 -> /channel.php?id=146
RewriteRule ^channel/([0-9]+)$ /channel.php?id=$1 [QSA,L,NC]

# INDEX.PHP
# /movies-and-series/2019-12-10 -> /index.php?genre=movies-and-series&date=2019-12-10
RewriteRule ^([a-zA-Z0-9-]+)/([0-9-]+)$ /index.php?genre=$1&date=$2 [L,NC]

# /2019-12-10 -> /index.php?date=2019-12-10
RewriteRule ^([0-9-]+)$ /index.php?date=$1 [L,NC]

# /sport -> /index.php?genre=sport
RewriteRule ^([a-zA-Z0-9-]+)$ /index.php?genre=$1 [L,NC]

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
4
4iloveg, 2019-12-11
@4iloveg

RewriteRule ^channel/([0-9+])$
[0-9+] remove + out of bracket

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question