Rewriting /deleting part of the url

New to mod_rewrite? This is a good place to start.

Rewriting /deleting part of the url

Postby pat99 » Sun Sep 20, 2009 3:00 pm

Hello

I rewrote the url in my script and I have this:

$URL = get_option ( 'siteurl' ) . '/ID=' . $Term['ID'] . '&page_id=' . $GLOBALS['itt']['Variables']['Page']['ID'].'/cat/' . ( $Term['Title'] ) . '/' ;

which output for example:

http://www.mysite.com/ID=3&page_id=323/cat/bike

I am trying to get this:

http://www.mysite.com/cat/bike

And I really need help to code the rewriting in my htaccess.

Thanks

Pat
pat99
 
Posts: 10
Joined: Sat Jul 26, 2008 11:31 pm

Postby richardk » Mon Sep 21, 2009 10:23 am

Have you read FAQ: How to change a numeric ID into a name/title? Are you capable of editing your script?

To output /cat/bike
Code: Select all
$URL = get_option ( 'siteurl' ) . '/cat/' . ( $Term['Title'] ) . '/' ;
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby pat99 » Mon Sep 21, 2009 10:49 am

Yes I did read the FAQ and lot of posts on the forum and i already have edited the script so i have now

$URL = get_option ( 'siteurl' ) . '/ID=' . $Term['ID'] . '&page_id=' . $GLOBALS['itt']['Variables']['Page']['ID'].'/cat/' . ( $Term['Title'] ) . '/' ;

instead of what was much more complicated url BUT i still dont understand how to rewrite the url to get:

http://www.mysite.com/cat/bike

instead of

http://www.mysite.com/ID=3&page_id=323/cat/bike

this would output the last part allright

$URL = get_option ( 'siteurl' ) . '/cat/' . ( $Term['Title'] ) . '/' ;

but how do i write the whole thing together?
pat99
 
Posts: 10
Joined: Sat Jul 26, 2008 11:31 pm


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 30 guests

cron