Help me re-write index.php Expert Enter

Started on the old forum in April 2012 · view the original in the archive · old links redirect here

16 replies · 1,044 views · started 14 years ago · 1 min read

5 participants
BDplanet Junior · 37 posts #1

i want re-write my index.php it output now loking

http://rexmob.com/index.php?page=category&id=889&indir=Mobile-Themes

but i want

http://rexmob.com/category/889/Mobile-Themes.html

and this is my index.php

<a href=\"index.php?page=category&id=$value->id&indir=$lname\">$name
</a> [$fCount]

i need only rewite on and some modify in my .htaccess file or need put some change in my index.php plz help me urgent expert bro... tnx advace..

Added after 26 minutes:

i try it my self but not working

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /index.php?page=$1&id=$2&indir=$3 [L]
just_m3. Developer · 199 posts #2

BDplanet wrote: i want re-write my index.php it output now loking

http://rexmob.com/index.php?page=category&id=889&indir=Mobile-Themes

but i want

http://rexmob.com/category/889/Mobile-Themes.html

and this is my index.php

<a href=\"index.php?page=category&id=$value->id&indir=$lname\">$name
</a> [$fCount]

i need only rewite on and some modify in my .htaccess file or need put some change in my index.php plz help me urgent expert bro... tnx advace..

Added after 26 minutes:

i try it my self but not working

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /index.php?page=$1&id=$2&indir=$3 [L]

The rewrite rulle is good

try and put this on your index .. and see if it works 😊

<a href="/category/$value->id/$lname.html">$name</a> [$fCount]

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

m4ster_v4 Developer · 125 posts #3

BDplanet wrote: i want re-write my index.php it output now loking

http://rexmob.com/index.php?page=category&id=889&indir=Mobile-Themes

but i want

http://rexmob.com/category/889/Mobile-Themes.html

and this is my index.php

<a href=\"index.php?page=category&id=$value->id&indir=$lname\">$name
</a> [$fCount]

i need only rewite on and some modify in my .htaccess file or need put some change in my index.php plz help me urgent expert bro... tnx advace..

Added after 26 minutes:

i try it my self but not working

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /index.php?page=$1&id=$2&indir=$3 [L]

Try, RewriteRule ^category/([0-9]+)/([a-zA-Z_-]+).html$ index.php?page=category&id=$1&indir=$2[L]

xD

If ur category not fixed variable use ([a-z]+) since it is in lower case

Visit my WEBSITE Project: http://www.aspirewap.net

arnage Lead · 811 posts #4

BDplanet wrote: i want re-write my index.php it output now loking

http://rexmob.com/index.php?page=category&id=889&indir=Mobile-Themes

but i want

http://rexmob.com/category/889/Mobile-Themes.html

Its like this. 😉

RewriteRule ^/page/([a-z]+)/id/([0-9]+)/indir/([a-zA-Z-]+)\.html$ index.php?page=$1&id=$2&indir=$3
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
m4ster_v4 Developer · 125 posts #5

arnage wrote: Its like this. 😉

RewriteRule ^/page/([a-z]+)/id/([0-9]+)/indir/([a-zA-Z-]+)\.html$ index.php?page=$1&id=$2&indir=$3

Does it will return

http://rexmob.com/page/category/id/889/indir/Mobile-Themes.html

? m8? Just asking for knowledge purpose. ^^

Visit my WEBSITE Project: http://www.aspirewap.net

arnage Lead · 811 posts #6

Yep. 🙂

somesite.tld/page/category/id/889/indir/Mobile-Themes.html

This,

category/889/Mobile-Themes.html

... i never tried to rewrite, i think its should be the code like,

if (isset($_GET['category'])) {
if (isset($_GET['id'])) {
if (isset($_GET['Mobile-Themes'])) {
// page...
}
}
}

But i guess its not the case here. 🙂

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
just_m3. Developer · 199 posts #7

arnage wrote: Its like this. 😉

RewriteRule ^/page/([0-9]+)/id/([0-9]+)/indir/([a-zA-Z-]+)\.html$ index.php?page=$1&id=$2&indir=$3

For me it works like this 🤣

<?php 
/* make a php file named checkitout.php 

and add.htaccess lines 

RewriteEngine on
RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /checkitout.php?page=$1&id=$2&indir=$3 [L]

*/ 

/*Now let's check it out :D */

if(isset($_GET['page'])){echo 'Page-> '.$_GET['page'].' & Id -> '.$_GET['id'].' & Indir -> '.$_GET['indir'].'';}

else{$myid='889';
$mydir='My-wap-category';

// link is looking like this http://127.0.0.1/category/889/My-wap-category.html

echo "<a href=\"/category/$myid/$mydir.html\">Test rewrite</a> ";}

?>

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

arnage Lead · 811 posts #8

just_m3. wrote: For me it works like this 🤣

<?php 
/* make a php file named checkitout.php 

and add.htaccess lines 

RewriteEngine on
RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /checkitout.php?page=$1&id=$2&indir=$3 [L]

*/ 

/*Now let's check it out :D */

if(isset($_GET['page'])){echo 'Page-> '.$_GET['page'].' & Id -> '.$_GET['id'].' & Indir -> '.$_GET['indir'].'';}

else{$myid='889';
$mydir='My-wap-category';

// link is looking like this http://127.0.0.1/category/889/My-wap-category.html

echo "<a href=\"/category/$myid/$mydir.html\">Test rewrite</a> ";}

?>

Posted link was index.php?page=category&id=889&indir=Mobile-Themes and for that this is not gonna work without recoding php, which is totally different story. 😉

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
just_m3. Developer · 199 posts #9

arnage wrote: Posted link was index.php?page=category&id=889&indir=Mobile-Themes and for that this is not gonna work without recoding php, which is totally different story. ;)

Yupe' thats true, but he also said that want the link to look like this

http://somesite.tld/category/889/My-wap-category.html

and not like http://somesite.tld/page/category/889/My-wap-category.html

if he want that result he should put some bones to work : D ..

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

m4ster_v4 Developer · 125 posts #11

BDplanet wrote: why im lossing css and all img view see here

okay use this RewriteRule ^category/([0-9]+)/([a-zA-Z_-]+).html$ **/home/USERNAME/public_html/**index.php?page=category&id=$1&indir=$2[L]

change USERNAME with ur accout name. this is my basic knowledge maybe can try other codes ^^

or just add / before index /index.php maybe. not test yet

Visit my WEBSITE Project: http://www.aspirewap.net

just_m3. Developer · 199 posts #12

BDplanet wrote: why im lossing css and all img view see here

Use http://linked.tld/style.css instead ./style.css because rewrite rulles can skrew things 🙂 ...

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

BDplanet Junior · 37 posts #13

m4ster_v4 wrote: okay use this RewriteRule ^category/([0-9]+)/([a-zA-Z_-]+).html$ **/home/USERNAME/public_html/**index.php?page=category&id=$1&indir=$2[L]

change USERNAME with ur accout name. this is my basic knowledge maybe can try other codes ^^

or just add / before index /index.php maybe. not test yet

same

RewriteEngine On
RewriteRule ^category/([0-9]+)/([a-zA-Z_-]+).html$ /home/rexmob/public_html/index.php?page=category&id=$1&indir=$2[L]

here is my index.php plz fix it

Attachments: index.zip
m4ster_v4 Developer · 125 posts #14

BDplanet wrote: same

RewriteEngine On
RewriteRule ^category/([0-9]+)/([a-zA-Z_-]+).html$ /home/rexmob/public_html/index.php?page=category&id=$1&indir=$2[L]

here is my index.php plz fix it

if include remove ./ eg: include "lol.php";, include ("lol.php"); if link, photo add / eg: /index.php, /img/logo.gif, /css/style.css

Just from my experience.

Visit my WEBSITE Project: http://www.aspirewap.net

asifnayem Developer · 119 posts #17

rewrite code:

RewriteRule ^(.*)/([0-9]+)/(.*).html$ index.php?page=$1&id=$2&indir=$3 [L]

if the problem is not showing the color of css then share your header page bcoz the css links are in there. or u can try on ur own by changing the css links with:

 http://ursite.con/css/style.css 

instead of using

../css/style.css.

it will work just fine.

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close