0
I am having problems with my URL friendly, I have a code that already works, however for a specific directory.
.htaccess
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1
index php.
$url = (isset($_GET['url'])) ? $_GET['url'] : 'mdjr_home';
$arq_perm = array('mdjr_home','mdjr_contatos','mdjr_orcamento',
'mdjr_portifolio','mdjr_quem_somos','mdjr_videos','mdjr_teste');
$pasta = "producoes/page_mdjr/pages_menu";
if (substr_count($url,'/') == 0)
{
$url = explode('/',$url);
$page = (file_exists("{$pasta}/".$url[0].'.php') && in_array($url[0],$arq_perm)) ? $url[0] : "404";
$id = intval(isset($url[1]));
}elseif(substr_count($url,'/') == 0)
{
$page = (file_exists("{$pasta}/".$url.'.php') && in_array($url[1],$arq_perm)) ? $url : "404";
$id = 0;
// echo $page;
}
require ("{$pasta}/{$page}.php");
Just added it to my menu. php and my friendly menu url works,, but in my home which is the main page I have some cards it generates me these urls:
mdjr/producoes/controller/controller.php?card=0
mdjr/producoes/controller/controller.php?card=1
mdjr/producoes/controller/controller.php?card=2
mdjr/producoes/controller/controller.php?card=3
mdjr/producoes/controller/controller.php?card=4
because by clicking it opens the link of the page
mdjr/producoes/controller/controller.php
where I say what will be displayed on each thing, but I don’t know what to do for both the php code in my index.php and my . htaccess works until I included some of those codes in the . htaccess but it didn’t work out. I tried to add :
RewriteRule ^(.*)\/?(.*)\/?$ index.php?url=$1&card=$2
RewriteRule ^producoes/controller/([a-z0-9-]+)/([0-9]+)/?$/controller.php?url=$2&card=$1 [NC]
RewriteRule ^producoes/controller/.*?$ controller.php?card=$1
Along with the existing but nothing works, always returns the error page, without it the page is opened normally and works, but when adding these codes give error.
What exactly is the URL template you need. Post an example of how you would like the URL to be
– dm707
Is this the full address http://localhost/mdjr/producoes/controller/controller.php? card=0 would like it to be after the/mdjr/controller domain only that, regardless of the id I clicked, or it could be with the after without problems, but I don’t know if it all depends solely on php or somnete’s programming. htaccess
– joannes