UnknownPlayer Posted July 25, 2011 Share Posted July 25, 2011 I have problem, on my localhost, this website works fine: http://des-kom.com/usluge/vez but on this hosting, it doesn't show articles in that link, i dont know why, but on this link: http://des-kom.com/masine it works.. so i think that problem is with htaccess code: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(usluge|masine|o-nama|kontakt|admin)$ ./$1.php [L,QSA] RewriteRule ^usluge/(.*)$ usluge.php?q=$1 [L,QSA] RewriteRule ^masine/(.*)$ masine.php?q=$1 [L,QSA] In usluge.php file, i explode all queries with "/"(explode("/",$_GET['q']) so it explode this categorie vez, but it cant read, i dont know why ? In masine.php is without explode, just showing items, no categories.. Can anyone help me? btw php version is 5.2.17 and on my localhost is 5.3.0.. Quote Link to comment https://forums.phpfreaks.com/topic/242806-help-with-htaccess-and-php/ Share on other sites More sharing options...
requinix Posted July 25, 2011 Share Posted July 25, 2011 What's the code in usluge.php? Quote Link to comment https://forums.phpfreaks.com/topic/242806-help-with-htaccess-and-php/#findComment-1247084 Share on other sites More sharing options...
UnknownPlayer Posted July 26, 2011 Author Share Posted July 26, 2011 <?php include("includes/header.php"); if (empty($_GET['q'])) redirect_to(SITE_URL."usluge/vez"); ?> <div id="sadrzaj"> <ul class="meni2"> <?php if (!empty($_GET['q'])) { $url_data = explode("/",$_GET['q']); } ?> <li<?php if (!empty($_GET['q']) && ($url_data[0] == "vez")) echo ' id="aktivan"'; ?>><a href="<?php echo SITE_URL; ?>usluge/vez"><?php echo get_kategorija_naziv(1, $pod_jezik) ?></a></li> <li<?php if (!empty($_GET['q']) && ($url_data[0] == "čenil")) echo ' id="aktivan"'; ?>><a href="<?php echo SITE_URL; ?>usluge/čenil"><?php echo get_kategorija_naziv(2, $pod_jezik) ?></a></li> <li<?php if (!empty($_GET['q']) && ($url_data[0] == "cirkoni")) echo ' id="aktivan"'; ?>><a href="<?php echo SITE_URL; ?>usluge/cirkoni"><?php echo get_kategorija_naziv(3, $pod_jezik) ?></a></li> <li<?php if (!empty($_GET['q']) && ($url_data[0] == "šljokice")) echo ' id="aktivan"'; ?>><a href="<?php echo SITE_URL; ?>usluge/šljokice"><?php echo get_kategorija_naziv(4, $pod_jezik) ?></a></li> </ul> <hr> <div id="proizvodi"> <?php if (!empty($url_data)) { if (count($url_data) == 1) { prikazi_usluge($_GET['q']); } elseif (count($url_data) == 2) { if (!empty($url_data[1])) prikazi_proizvod($url_data[1], "usluge"); } } ?> </div> </div> <?php include("includes/footer.php"); ?> That is code.. This code: if (count($url_data) == 1) { prikazi_usluge($_GET['q']); } is to show all articles for that categorie that is in $_GET['q'] (example: vez) And this code: elseif (count($url_data) == 2) { if (!empty($url_data[1])) prikazi_proizvod($url_data[1], "usluge"); } is to show that article, $url_data[1] is seo name for that article and $url_data[0] is categorie name.. example vez/article-1 Quote Link to comment https://forums.phpfreaks.com/topic/242806-help-with-htaccess-and-php/#findComment-1247087 Share on other sites More sharing options...
UnknownPlayer Posted July 26, 2011 Author Share Posted July 26, 2011 Please help me, i really need this to work Quote Link to comment https://forums.phpfreaks.com/topic/242806-help-with-htaccess-and-php/#findComment-1247247 Share on other sites More sharing options...
requinix Posted July 26, 2011 Share Posted July 26, 2011 Do you know whether prikazi_usluge() works properly? Have you tried basic debugging steps like printing messages and values? Quote Link to comment https://forums.phpfreaks.com/topic/242806-help-with-htaccess-and-php/#findComment-1247448 Share on other sites More sharing options...
UnknownPlayer Posted July 26, 2011 Author Share Posted July 26, 2011 Tha function works, i mean whole page works on my localhost(apache server) but on hosting service, this does not work.. php version on hosting is 5.2.17 and on my localhost is 5.3.0.. I tried with echo $_GET['q']; but it does not show anything, like q is empty :/ btw this domain www.des-kom.com is addon domain in cpanel.. if that make some changes.. Quote Link to comment https://forums.phpfreaks.com/topic/242806-help-with-htaccess-and-php/#findComment-1247590 Share on other sites More sharing options...
UnknownPlayer Posted July 27, 2011 Author Share Posted July 27, 2011 Maybe the problem is that on my hosting, variables are disabled in htaccess, in php.ini or something like that? Quote Link to comment https://forums.phpfreaks.com/topic/242806-help-with-htaccess-and-php/#findComment-1247823 Share on other sites More sharing options...
requinix Posted July 27, 2011 Share Posted July 27, 2011 And the .htaccess you posted is exactly what you have now? Nothing more, nothing less? Character for character identical? Quote Link to comment https://forums.phpfreaks.com/topic/242806-help-with-htaccess-and-php/#findComment-1248085 Share on other sites More sharing options...
UnknownPlayer Posted July 27, 2011 Author Share Posted July 27, 2011 RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(usluge|masine|o-nama|kontakt|admin)$ ./$1.php [L,QSA] RewriteRule ^usluge/(.*)$ usluge.php?q=$1 [L,QSA] RewriteRule ^masine/(.*)$ masine.php?q=$1 [L,QSA] RewriteRule ^admin/masine$ ad_masine.php [L,QSA] RewriteRule ^admin/usluge$ ad_usluge.php [L,QSA] RewriteRule ^admin/admin$ ad_admin.php [L,QSA] RewriteRule ^admin/(.*)/(.*)/akcija/(.*)$ ad_$3.php?mod=$1&q=$2 [L,QSA] That is my .htaccess file.. Its seams that variables doesnt work but i dont know another solution btw folder where is this website located on hosting is "/public_html/des-kom.com", just for record if it is important.. Quote Link to comment https://forums.phpfreaks.com/topic/242806-help-with-htaccess-and-php/#findComment-1248217 Share on other sites More sharing options...
UnknownPlayer Posted July 28, 2011 Author Share Posted July 28, 2011 It works on my computer but on hosting it doesnt work, please help me? Quote Link to comment https://forums.phpfreaks.com/topic/242806-help-with-htaccess-and-php/#findComment-1248791 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.