|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
URL rewriting (?)
Hello,
To make my upcoming website seo friendly I want to implement some URL rewriting (I guess, if someone knows a better solution to the following please let me know). The website is a webshop with a lot of different products. The website is in php so normally I would write my product pages something like this: mysitedotcom/product.php?ID=100&Categorie=Hat&Subcategorie=Red%20Hat&Name=Superflex%20Red%20Hat All the information for the different Categorie, Subcategorie and Name would be pulled from a MYSQL database. What I want to do is make the URL like this: mysitedotcom/Hat/Red-Hat/Superflex-Red-Hat.html So what I need is: - PHP must become .HTML - Database fields must be used to make a "tree" in the URL (--> /.../...) - ID should not be visible because this doesn't say anything about the product - I want "- " implemented for spaces so that the internet explorer doen't give the standard "%20" How do I do this? Also, I do not want to link from one page to "mysitedotcom/product.php?ID=100&Categorie=Hat&Subcategorie=Red%20Hat&Name=Superflex%20Red%20Hat" where it rewrites to "mysitedotcom/Hat/Red-Hat/Superflex-Red-Hat.html" on that page. In fact, I don't want this contruction (mysitedotcom/product.php?ID=100&Categorie=Hat&Subcategorie=Red%20Hat&Name=Superflex%20Red%20Hat) visible anywhere in my website code for Google to see. How do I pull this off and can this be done using Dreamweaver. I guess this is quite a request, if u need more info, please let me know. I do know a website who does this very well (www dot klara dot nl !!! not so suitable for work however) They do this in not only their productpages, but also their category and subcategory pages, which is exactly what I want to do. Many thanks in advance! |
|
#2
|
||||
|
||||
|
Here is a useful toolto help you http://www.seochat.com/seo-tools/url-rewriting/
|
|
#3
|
||||
|
||||
|
This will require "alot" a work most likely, and require editing of your webshops backend. Here is an idea, you should search your webshops website to see if any mods\addons exist already to create SEO friendly URLs, if not you might want to hire a freelance to do this work for you, I highly doubt anyone will go beyond linking you to apache url modding resources.
|
|
#4
|
|||
|
|||
|
Quote:
The thing is that this website still needs to be build and I want to do it right the first time. So, I can really still do anything.... I'll have a look around, but if anyone here has some experience or really solid suggestions I would love to hear them. kind regards. |
|
#5
|
||||
|
||||
|
Quote:
I would take a look at ZenCart and OSCommerce then for your backend. |
|
#6
|
|||
|
|||
|
depending on what software you use for your website, i would suggest looking for any SEO plugins. most major php software suites have SEO modifications or plugins. doing this task yourself is daunting.
|
|
#7
|
|||
|
|||
|
Quote:
I agree, I have thought about the things I would need to do to implement this troughout the site. The problem of rewriting the URL for product pages does not seem to be the biggest problem, however, I also want to link directly to the correct link obviously (so this isn't rewriting anymore is it?) and how on earth do websites like i mentioned get the right data for their product page? I always used a GET method where the product ID was in the URL, but this isn't possible using link building like this... If anyone has experience making these websites and can tell me what the best software is for doing this job (prefferebly free software as I do not have a large amount of money to invest) please let me know. If you could also tell me how the mechanics of websites like www dot klara dot nl work (NSFW!) (Sorry, is one of the only websites I know who really did the job well implementing good links) please let me know, I am VERY interested of implementing this idea the correct way when I start! Thanks. |
|
#8
|
||||
|
||||
|
What you are talking about depends on what is the platform of your server. If you are using php it is most likely Apache (linux). If so, then you would use mod_rewrite. I was in the same situation for a IIS (windows) server and there are products for that that are different. Find out some info on your server first and post back.
__________________
A sig test: castrol srf | Graphical Force "When everybody is special . . . nobody will be." -Syndrome |
|
#9
|
|||
|
|||
|
Quote:
I am currently looking for a linux based server. However, I am very flexible on this one because I have worked on both in the past for small webshops. (So if windows is easier I could look at that as well..) |
|
#10
|
|||
|
|||
|
Quote:
Hi, Thanks for the tool, it seems quite handy, but doesn't this leave me with a lot of problems? For instance, when I link page 1 to the dynamic page, doesnt the original link still apply on page 1? So wouldn't this be the case: on page 1 this link: mysite dot com/product.php?id=1&name=Example would link to the rewritten dynamic page mysite dot com/product/ID/1/Name/Example/ ???? If the 'linking URL' in the code would also be converted then this would help a lot. |
|
#11
|
||||
|
||||
|
Quote:
I would suggest using 301 redirects on your original URL's to your new URL's. |
|
#12
|
|||
|
|||
|
Hello Joppiesaus,
There is 2 way for URL Rewriting. One is to using POST on the place of GET. And another is by Apache URL Rewriting. you can see it on this location: httpddotapachedotorgslashdocsslash1dot3slashmiscsl ashrewriteguidedothtml |
|
#13
|
||||
|
||||
|
Implementing mod_rewrite in the manner you've suggested is involved, but taken step by step it shouldn't be that daunting.
First thing is to take a look at the .htaccess rules, eg. Code:
RewriteRule ^/(.*)/(.*)/(.*)\.html$ /product.php?Categorie=$1&Subcategorie=$2&Name=$3 Here you can see that we pass 3 variables, split by forward slashes, to the script: Categorie, Subcategorie, and Name. As you've already mentioned, the ID variable is no longer present, so that rules out the ability to fetch the required product from the database according to its ID number. Instead you need to look at what other variable you can use. In the case above that would be Name. It's still not ideal though, as in a larger shop there's plenty of opportunity to have more than one product with the same name. Secondly, you'd need to replace hyphens with spaces via php before calling the database, but what if the product name has hyphens in it? Too much possibility for error for my liking. What to do then? My personal preference would be to introduce a new variable: Slug. This would be stored as a seperate, indexed column in the database, and would equate to the pseudo filename, avoiding any escaped characters. In your example URL ( /Hat/Red-Hat/Superflex-Red-Hat.html ), Slug would be "Superflex-Red-Hat". So, instead of searching the database for $_GET['ID'], you'd be searching for $_GET['Slug'] (sanitizing the input of course). The .htaccess code would then be something like: Code:
RewriteRule ^/(.*)/(.*)/(.*)\.html$ /product.php?Categorie=$1&Subcategorie=$2&Slug=$3 Constructing the URL The next step would be to create a function to construct the URL to maintain consistancy, eg So, in product category lists for example: 301 redirects You also need to ensure that the old style URLs are no longer available. The easiest way is to check for the value of $_SERVER['REQUEST_URI'] If a '?' is present it's an old style one, and so retrieve the data, pass it through the writeUrl() function, and redirect. By checking for old-style URLs it does at least mean that missing a hard-coded URL somewhere in your site isn't going to lead to duplicate pages. I would also implement a check for the categories. If you happen to move the product to a different category, the URL would still work if you were just searching the database for $_GET['Slug']. Perhaps even consider removing the categories from the URL altogether. That way it may be possible to remove some database requests for category data just to construct the URL (speeding up the site), and should you decide to change categories you don't have to change the URL as well (providing long term URL stability). Without seeing the existing code for your site I can't really be any more precise, but it should at least give you some food for thought.
__________________
... I'll be back for breakfast
New to SEO? SEOChat SEO FAQsForum Rules and Posting Guidelines URL canonicalization code solutions Vigorously pursuing the floccinaucinihilipilification of cheap SEO tricks
|
|
#14
|
|
|
|