All Good Things Must Come To An End

As you all know, I have been doing WordPress plugins and supporting it for the past 6 years. These 6 years of my life, I have been through my polytechnic education, my national service as well as my university education.

I just graduated from university in December 2009 and have been looking for full-time jobs. I am offered a full-time job and will be starting work on 1st February 2010.

I regret to say that I am NOT ABLE to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

However, I WILL still update my plugins whenever I can and you still can report bugs to me via email and I will try to fix it.

Author Topic: URL Rewriting / SEO Friendly URLs  (Read 17175 times)

0 Members and 1 Guest are viewing this topic.

Offline macvwin

  • Jr. Member
  • **
  • Posts: 41
    • View Profile
URL Rewriting / SEO Friendly URLs
« on: 10 May 2008, 12:09 »
I need some help getting my URLs to work with URL Rewriting, so i have gotten so far as to the .htaccess rewrite. my url are as follow:

index.php?id=page

this translates into .htaccess like this, that is if i want my pages to look like subfolders:

Options +FollowSymLinks
RewriteEngine on
RewriteRule index/id/(.*)/ index.php?id=$1


Now how do i go about coding my php file so it treats the above .htaccess rule into the browser, like this:

http://www.yourdomain/index/id/PAGE_HERE

P.S. I have gotten as far as this, but have no idea where to place this and how to do so in my php file?

Dynamically Generated URL

http://www.yourdomain.com/index/id/[VALUE]

I would really appreciate if anyone could help me do this..thanks

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,692
    • View Profile
  • WordPress Version: WordPress 3.0.x
  • Theme Name: lesterchan.net v3.4
Re: URL Rewriting / SEO Friendly URLs
« Reply #1 on: 11 May 2008, 03:11 »
you can get the value with [VALUE] = $_GET['id']

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline macvwin

  • Jr. Member
  • **
  • Posts: 41
    • View Profile
Re: URL Rewriting / SEO Friendly URLs
« Reply #2 on: 12 May 2008, 15:09 »
Hi GaMerz, thanks for replying, at least someone is trying to help me.. :D.

Ok here is what i got on my php file and this is how my php navigation system looks like:

<?php switch($id) { default: include('home.php');
break; case "page1": include('page18767.php');
break; case "page2": include('page443545.php');
break; case "page3": include('page34535.php');
break; case "page4": include('page4234.php');

} ?>

Now how can i code the Rewrite part into this? Where does the [VALUE] = $_GET['id'] go?

thanks

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,692
    • View Profile
  • WordPress Version: WordPress 3.0.x
  • Theme Name: lesterchan.net v3.4
Re: URL Rewriting / SEO Friendly URLs
« Reply #3 on: 12 May 2008, 15:46 »
Code: [Select]
<?php
$id 
intval($_GET['id']);
switch(
$id) { default: include('home.php');

break; case 
"page1": include('page18767.php');
break; case 
"page2": include('page443545.php');
break; case 
"page3": include('page34535.php');
break; case 
"page4": include('page4234.php');

?>


++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline macvwin

  • Jr. Member
  • **
  • Posts: 41
    • View Profile
Re: URL Rewriting / SEO Friendly URLs
« Reply #4 on: 12 May 2008, 17:28 »
thanks GaMerz, that worked fine but i run into a little problem, im using html but the extensions are .php and i have the index.php page in that i have this code:

<?php
$id = intval($_GET['id']);
switch($id) { default: include('home.php');

break; case "page1": include('page18767.php');
break; case "page2": include('page443545.php');
break; case "page3": include('page34535.php');
break; case "page4": include('page4234.php');

} ?>

and the htaccess worked fine to get the pages with .html extension with this in the .htaccess:

RewriteEngine on
RewriteBase /
RewriteRule ^([^/]*)\.html$ $1.php?%{QUERY_STRING} [NC]

but, when i preview the page e.g.

http://domain.com/page1.html it doesnt appear within the index.php file but it opens in a new window and shows the content i dont want this as im using the "break; case "page1": include('page18767.php');" function, and i want it to appear within the index.php file just like before like "index.php?id=page" but this time page.html within the index.php..please help coz im finding it very confusing.

thanks

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,692
    • View Profile
  • WordPress Version: WordPress 3.0.x
  • Theme Name: lesterchan.net v3.4
Re: URL Rewriting / SEO Friendly URLs
« Reply #5 on: 12 May 2008, 17:53 »
Hmm, I think your htaccess rule is wrong, I am not that good with regex.
Code: [Select]
RewriteRule ^(.+[^/])\.html$ index.php?id=\$1 [QSA,L]If that does not work, you can try asking in sitepoint.com forums. I always ask for help there. lol

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline macvwin

  • Jr. Member
  • **
  • Posts: 41
    • View Profile
Re: URL Rewriting / SEO Friendly URLs
« Reply #6 on: 12 May 2008, 18:50 »
hi again..thanks GaMerz for your help finally i got it working like a charm :)..my version of my php is not working with the system i have as mentioned above dont know why though, so i went back to the default system php and it works great..thanks so much for your input. ;)

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,692
    • View Profile
  • WordPress Version: WordPress 3.0.x
  • Theme Name: lesterchan.net v3.4
Re: URL Rewriting / SEO Friendly URLs
« Reply #7 on: 12 May 2008, 19:45 »
no problem =)

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline here2help

  • Newbie
  • *
  • Posts: 1
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: My SEO Help
Re: URL Rewriting / SEO Friendly URLs
« Reply #8 on: 16 March 2010, 20:35 »
Thanks gamerz that really did help me, i had the same problem with my htaccess file access rule.
It's funny how a few years old thread like this can help out some one few years later and it probably will stay to help others in the next few decades  :)
I do my seo work with this SEO Software