v2.5.2
Giriş yap

Php htaccess hatası

mesut33
395 defa görüntülendi ve 1 kişi tarafından değerlendirildi

Merhaba Tayfun Hocanın Udemy setini çıktığı ilk zamanlar almış ve geliştirmeye çalışıyordum kendi çabalarımla
nerneyse çoklu dil yapmak istedim tr/en bunu yaptığım içinde controllerim 0 değil 1 oldu haliyle, gerekli ayarları yaptıktan sonra blog/ refenas admin vb. ama dinamik olarak yapmış olduğum sayfalama çalışmıyor.
category ve serviceyi htaccess yazdığımda indexte yazmış olduğum if koşulunu yerine getirmiyor ve
ve haliyle corporate controllerını arıyor öyle bir kontroller yok çünkü onu ben category.php
diye htaccess yazdım ve about-us'da servis diye tanımladım. htaccess devreye girmediği için
böyle bir hata alıyorum. Tayfun Hocam Lütfen Konuya el atarsanız çok mutlu ederseniz.
tam 3 gündür uğraşıyorum hiçbir şekilde sonuç alamadım.
Not:index.php?lang=$1&category=$2&service=$3 [QSA] kodunu indexten önce yazdığımda
if koşulum yerine getiriliyor ama diğer controllerin yapısı bozuluyor ve 404 sayfasına atıyor.

link
http://mysite/en/corporate/about-us

hata
Warning: require(D:xampphtdocs/app/controller/corporate.php):
failed to open stream: No such file or directory in
D:xampphtdocsindex.php on line 36

Fatal error: require(): Failed opening required 'D:xampphtdocs/app/controller/corporate.php'
(include_path='D:xamppphpPEAR') in D:xampphtdocsindex.php on line 36

index.php

if ((isset($_GET['lang']) && $_GET['lang']) &&
(isset($_GET['category']) && $_GET['category']) &&
(isset($_GET['service']) && $_GET['service'])) {

require_once './app/controller/category.php';
exit();

}
$routeExplode = explode('?', $_SERVER['REQUEST_URI']);

$route = array_values(array_filter(explode('/', $routeExplode[0])));

if (!route(1)) {

$route[1] = 'index';

}

require controller(route(1));

.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

RewriteRule ^([a-z]{2})/?([a-zA-Z0-9-_/]+)?$ index.php?lang=$1 [QSA]
RewriteRule ^([a-z]{2})/([a-z0-9-]{3,})/([a-z0-9-]+)$ index.php?lang=$1&category=$2&service=$3 [QSA]
RewriteRule ^sitemap.xml$ sitemap.php [NC,L]

app.php
unction route($index)
{

global $route;
return isset($route[$index]) ? $route[$index] : false;

}
function controller($controllerName)
{

$controllerName = strtolower($controllerName);
return PATH . '/app/controller/' . $controllerName . '.php';

}

function view($viewName)
{

return PATH . '/app/view/' . setting('theme') . '/' . $viewName . '.php';

}

category.php
<?php
extract($_GET);

$service_ = Blog::getService($category, $service);
$categoryurl = Blog::getServiceCategoriesPage($service['page_categories']);
if (!$service_) {

header('Location:' . site_url('404'));
exit;

}

$seo = jsondecode($service['page_seo'], true);

$meta = [

'title' => $seo['title'] ? $seo['title'] : $service_['page_title'],
'description' => $seo['description'] ? $seo['description'] : cut_text($service_['page_content'])

];

$pages = $db->from('pages')

->select('pages.*')
->where('page_categories', $service_['page_categories'])
->where('page_status', '1')
->all();

$slider = $db->from('page_images')

->where('image_page_id ', $service_['page_id'])
->where('image_status', '1')
->orderby('image_order', 'ASC')
->all();

require view('category');

Cevap yaz
Cevaplar (0)
Henüz kimse cevap yazmadı. İlk cevap yazan sen ol!