Can anyone tell if this would work?
Moderator: General Moderators
Can anyone tell if this would work?
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.
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.
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.
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.
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
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
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
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
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
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.
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.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Filesystem http://domain.com/34982304832ianhull 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.
ModRewrite http://domain.com/34982304832
I don't see any difference
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 atianhull 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'
Code: Select all
echo '<pre>';
print_r($_SERVER);
echo '</pre>';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...
Thanks
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>- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact: