Jump to content

help with htaccess and php..


UnknownPlayer

Recommended Posts

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..

Link to comment
https://forums.phpfreaks.com/topic/242806-help-with-htaccess-and-php/
Share on other sites

<?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

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..

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..

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.