Page 1 of 1

Can anyone tell if this would work?

Posted: Sun Oct 29, 2006 9:59 am
by ianhull
Hi Guys,

I have had a look at mod_rewrite but I dont really want to go down that path.

I was having a think about how to make SEO friendly urls and I am wondering if there is anything I have overlooked.

My system is all database driven.
When a new record is entered into my DB I was thinking of creating a directory using php using the recordID and generating a index.php page

Then on my generated links instead of using my.php?item=
use http://www.domain.com/9778564

Then in my index.php page get the current directory from the address bar using javascript and the query my database relating to the directory name against the recordID

would this keep all my urls neat and tidy and SEO friendly?

is there anything I have overlooked?

Thanks in advance.

Posted: Sun Oct 29, 2006 10:46 am
by Todd_Z
although its pleasing to the eye, having numeric ids in the url isn't really seo friendly.

SEO friendly urls would be like...


http://www.domain.com/232343/Blue-Shirt-Cheap.html


something like that using a short description in the url.

end the url with .html so that the search engine thinks its a static page, not necessarily important, but a nice touch. Otherwise, you can just mod_rewrite according to just the digits, the other stuff can be ignored.

A page that is like http://www.domain.com/232343/asdasdasdas.html would then reference the same page.

Posted: Sun Oct 29, 2006 11:21 am
by ianhull
Thanks for the advice, much apreciated.

After doing some research on SEO I have decided to not have any extention on any of my pages.

I understand what you mean about the numeric values as pages, this could maybe not be so good so I have decided to use the page title from my database instead of the RecordID

Kind regards
Ian

Anyone else think of anything more to add to this post please feel free,

the more advice and suggestions the better.

Thanks

Posted: Sun Oct 29, 2006 11:23 am
by John Cartwright
Why don't you want to use mod rewrite? It would make things much simpler than what you are suggesting. Infact, your method is extremely complicated in comparison.

Is it because you don't understand mod rewrite?

On a side note, search engines are usually up to date with query string, and see http://domain.com/?id=3234324 the same as http://domain.com/3234324

Posted: Sun Oct 29, 2006 11:43 am
by ianhull
I have had a look at the mod_rewrite but decided against it as my main objective is to build a system which not contain any variables and values on any a href links on my pages or address bar.


Here's how I see my system working.

MySQL

RecordID
PageTitle
PageContent
PageCreated

When a new page is created from the admin section I will use mkdir to create a directory based on the value of PageTitle

I will then copy a file index.php from another location on my server to this new directory.

The index.php file will contain javascript to get the current directory and then query the database WHERE PageTitle='PageTitle'

Thanks for any advice or suggestions.

Posted: Sun Oct 29, 2006 11:48 am
by John Cartwright
ianhull wrote:I have had a look at the mod_rewrite but decided against it as my main objective is to build a system which not contain any variables and values on any a href links on my pages or address bar.
Filesystem http://domain.com/34982304832
ModRewrite http://domain.com/34982304832

I don't see any difference :roll:
ianhull wrote: Here's how I see my system working.

MySQL

RecordID
PageTitle
PageContent
PageCreated

When a new page is created from the admin section I will use mkdir to create a directory based on the value of PageTitle

I will then copy a file index.php from another location on my server to this new directory.

The index.php file will contain javascript to get the current directory and then query the database WHERE PageTitle='PageTitle'
All this can be done using a single index.php file... and just for your information, there is no need to use javascript for this. I recommend you take a look at

Code: Select all

echo '<pre>';
print_r($_SERVER);
echo '</pre>';

Posted: Sun Oct 29, 2006 12:01 pm
by ianhull
now thats interesting

Could you tell me how this would work.


mod_rewrite???

I do not know where to place this, when I looked I assumed it was to go into httpd.conf Apache2


From my database I create a paginated result containing links


Query...

Code: Select all

<a href="'.$pagetitle.'">'.$pagetitle.'</a>
Thanks

Posted: Sun Oct 29, 2006 12:11 pm
by John Cartwright
First, can you show me how all your links will look in the end? (the ones you want mod_rewrite to capture)

Posted: Sun Oct 29, 2006 12:20 pm
by ianhull
my links will look like this

reports.php?pagetitle=Safety Alert
reports.php?pagetitle=Fire Safety

etc

Thanks Jcart