Permalinks using only PHP/MySQL?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sirugo
Forum Newbie
Posts: 2
Joined: Thu Sep 19, 2013 10:01 am

Permalinks using only PHP/MySQL?

Post by sirugo »

I have a created a quite simple script that builds permalinks, using PHP/MySQL.
Yes, I know that it is normally done by altering the htaccess-file, but my host does not provide it.

This works for me, but my question is if it's SEO-friendly.

Here goes:

1. I have a MySQL-table with all the pages on my site, indexed of course.

2. The database also contains most of the text that will be displayed on the pages. So... I don't have many static pages... but most of them are dynamic. Each page is connected to a manually created permalink string in the table.

For example: a page about "fast cars" may have id = 32. The permalink added is "fast-cars"

3. I have a php-script that reads the index of a page, fetches the permalink and then creates a folder with the name "fast-cars". It also creates a php-file in that folder (index.php) with the code:

<?php
header('Location: http://www.mysite.com/page.php?ix=32');
?>

So the "good looking" permalinked url calls a header with the "ugly" url.

This means that I can use permalinks wherever I want to and no one notices that there are dynamic pages running in the background.

Any drawbacks?
SEO-friendly?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Permalinks using only PHP/MySQL?

Post by requinix »

They'll notice when they get redirected to the correct page.

Sounds like your host is stupid. Do they support custom error pages? What do they offer? Can you change hosts?
sirugo
Forum Newbie
Posts: 2
Joined: Thu Sep 19, 2013 10:01 am

Re: Permalinks using only PHP/MySQL?

Post by sirugo »

I just contacted them and they DO have the htaccess file available.
I never saw it because it can only be found when I search it with my ftp client. It's not visible otherwise.
I didn't know that...
So now I can use the correct method.

Thanks!
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Permalinks using only PHP/MySQL?

Post by requinix »

Your FTP client probably has some sort of "show hidden files" (enable) or "show/hide dot files" (show) setting.
Post Reply