Jump to content

internal friendly links ala WordPress


lunac

Recommended Posts

Hi All,

 

I'm trying to make my code more "multiple" server friendly , because I'm finding I have to hack at it anytime I use it for a new client and whatever server configuration they have. SOOO... I want to be able to create links on the fly. I would have some config some where that would state whether to use conventional links or friendly links. If I'm using friendly links, I want to pass this off to be figured out within the php rather than in the .htaccess file. Basically, I want to do what WordPress has done so well.

 

Does anyone know how they did this, or has any tutorials about going about this?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/43027-internal-friendly-links-ala-wordpress/
Share on other sites

You could use mod_rewrite or let PHP do the job. To let PHP do it, see this: http://www.phpfreaks.com/tutorials/149/0.php - if you wish to get rid of the index.php part in the URL, then you'd have to place something like

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

in a .htaccess file and then generate it from $_GET['url'] instead of $_SERVER['PATH_INFO'].

yeah -- I think that's what I'm looking for

 

But I should have mentioned that not everything happens on the index page. For example:

/home/ and /about_us/  are both currently at index.php?page=home & index.php?page=about_us

 

However,

/classes/ and /schedule/ are located on their own pages /classmanager/index.php & /classmanager/schedule.php

 

Is this going to make a difference?

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.