Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
po stoti put - mod_rewrite

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
ToDD



Joined: 05 May 2005
Posts: 83
Location: Zagreb

PostPosted: 27.01.2006 12:01    Post subject: po stoti put - mod_rewrite Add user to your forum ignore list Reply with quote

za pocetak pretrazio sam cijeli forum ali nikako nejde

index.php
[PHP]
$id = $_GET['id'];

if($id == 4){echo 'sir';}

echo '<a href="?id=4">444</a>';
[/PHP]

.htaccess
Code:

RewriteEngine On
RewriteBase /
RewriteRule ^([^/\.]+)/?$ index.php?id=$1 [L]


stavljao sam i <a href="4/">444</a> i samo 4 ali bez uspjeha,dodao sam

#LoadModule rewrite_module modules/mod_rewrite.so
#AddModule mod_rewrite.c

u httpd.conf i opet nista. u cemu je stos?
Back to top
View user's profile Send private message MSN Messenger
_butch



Joined: 10 Sep 2003
Posts: 870
Location: Maichno, Krlovc

PostPosted: 27.01.2006 12:39    Post subject: Add user to your forum ignore list Reply with quote

Code:

LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.c


Uncomment te linije. Bile su ti komentirane, dakle Apache nije loadao mod_rewrite.
Mozes probati i ovaj rewrite rule.
Code:

RewriteRule ^[^.]*$ /index.php [L]

_________________
FRENCH GUARD: No chance, English bed-wetting types.
I burst my pimples at you and call your door-opening request a silly thing, you tiny-brained wipers of other people's bottoms!
Flikrac
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ToDD



Joined: 05 May 2005
Posts: 83
Location: Zagreb

PostPosted: 27.01.2006 12:50    Post subject: Add user to your forum ignore list Reply with quote

hm
kad dodam AddModule mod_rewrite.c onda mi uopce nece pokrenuti apache.
Back to top
View user's profile Send private message MSN Messenger
_butch



Joined: 10 Sep 2003
Posts: 870
Location: Maichno, Krlovc

PostPosted: 27.01.2006 13:19    Post subject: Add user to your forum ignore list Reply with quote

otvori log/error.log u Apache root-u i pogledaj sto ga muci.

_________________
FRENCH GUARD: No chance, English bed-wetting types.
I burst my pimples at you and call your door-opening request a silly thing, you tiny-brained wipers of other people's bottoms!
Flikrac
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
fun.ky



Joined: 05 Jan 2006
Posts: 365
Location: Mostar

PostPosted: 27.01.2006 13:20    Post subject: Add user to your forum ignore list Reply with quote

Koja ti je namjerea, da linkove tipa www.stranica.com/index.php?x=16&y=22 prebaciš u linkve tipa http://www.stranica.php/16/22 jel? ili nešto drugo?

Pozdrav

_________________
There is no style definition for good music!
Back to top
View user's profile Send private message Visit poster's website Twitter profile
ToDD



Joined: 05 May 2005
Posts: 83
Location: Zagreb

PostPosted: 27.01.2006 15:04    Post subject: Add user to your forum ignore list Reply with quote

fun.ky wrote:
Koja ti je namjerea, da linkove tipa www.stranica.com/index.php?x=16&y=22 prebaciš u linkve tipa http://www.stranica.php/16/22 jel? ili nešto drugo?

Pozdrav

da
Back to top
View user's profile Send private message MSN Messenger
fun.ky



Joined: 05 Jan 2006
Posts: 365
Location: Mostar

PostPosted: 27.01.2006 16:10    Post subject: Add user to your forum ignore list Reply with quote

OK Evo ti riješenje (barem može da ti bude ukoliko sam shvatio dobro Smile)

htaccess fle treba da ti sadrži

Code:
DirectoryIndex redirect.php
RewriteEngine on

RewriteRule ^stranica/([_0-9a-zA-Z\.-]+)$ index.php?x=$1



postavi ga na root stranice (na mjesto gdje ti se nalazi glavni index.php)

i onda umjesto da pozivaš index.php?x=12 upišeš stranica/12 tj stranica/parametar nadam se da ćeš iz ovoga moći skontati kako funkcioniše... Ukoliko bude problema napisat ću ti cijelu skriptu Smile

Poz.

_________________
There is no style definition for good music!
Back to top
View user's profile Send private message Visit poster's website Twitter profile
ToDD



Joined: 05 May 2005
Posts: 83
Location: Zagreb

PostPosted: 28.01.2006 02:52    Post subject: Add user to your forum ignore list Reply with quote

hm prvo ne zeli mi uopce apache pokrenut modul

bez ove linije ide
AddModule mod_rewrite.c


a drugo bio bi ti jako zahvalan da mi napravis neku banalnu skriptu jer ovako se sam mucim vec 3 tjedna
Back to top
View user's profile Send private message MSN Messenger
fun.ky



Joined: 05 Jan 2006
Posts: 365
Location: Mostar

PostPosted: 28.01.2006 12:22    Post subject: Add user to your forum ignore list Reply with quote

znači kad si odradio to sve sa htaccess-om kreiraš file index.php koji u sebi sadrži

Code:

<?php
$x = $_REQUEST['x'];

echo $x;
?>


Sada ovo spasi recimo ako ideš lokalno kreiraj folder proba i u njemu spai ovaj file kao index.php

onda umjesto da ga pozivaš sa localhost/proba/index.php?x=3434

pozvoeš ga sa localhost/proba/stranica/3434

I on će ti ispisati 3434 kao da si koristio prvu varijantu. umjesto 3434 moeš upisati šta želiš i on će ti to ispisati, znači proslijeđuješ mu parametar kao i do sada sa index.php?x=3434

Nadam se da je jasno

_________________
There is no style definition for good music!
Back to top
View user's profile Send private message Visit poster's website Twitter profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group