Answer the question
In order to leave comments, you need to log in
How to change url address?
At the moment I have this url: mvc-oop/news/one/?id=1
And how to make it like this: mvc-oop/news/one/1
I tried the CNC: I have everything set up like this
AddDefaultCharset utf -8
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine On
RewriteBase /
RewriteRule ^([az]+)/([az]+)/([0-9]+)/$ /?ctrl=$1&act=$2 &id=$3&%{QUERY_STRING} [NS,L]
RewriteRule ^([az]+)/([az]+)/$ /?ctrl=$1&act=$2&%{QUERY_STRING} [NS,L]
RewriteRule ^ ([az]+)/([0-9]+)/$ /?ctrl=$1&id=$2&%{QUERY_STRING} [NS,L]
RewriteRule ^([az]+)/$ /?ctrl=$1 &%{QUERY_STRING} [NS,L]
RewriteCond $1 !^(index\.php)
RewriteCond %{REQUEST_URI} !\.(css|js|jpg|gif)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA ]
At the mvc-oop/news/one/?id=1 address , it works for me. It displays one news item.
But when I want to go to the mvc-oop/news/one/1 address, display an error. How can I make it so that one news is displayed?
Notice: Undefined index: id in C:\OpenServer\domains\mvc-oop\www\controllers\News.php on line 23
Notice: Undefined offset: 0 in C:\OpenServer\domains\mvc-oop\www\classes\ AbstractModel.php on line 40
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question