User Jan wrote me with the following query about optimizing database driven websites.
I have a question about search engine friendly sites in regard to your article here about SEO of Database-driven Websites. I’m trying to make a website search engine friendly, using descriptive urls. Currently every link to a subpage looks like this: www.dom.ain/?visit=cat
So I only have 1 index file that provides information the user wants. Is there any way to improve this without creating a new php for every page on the site?
I thought about creating a *.htm that will route to the corresponding php url.
E.g. company.htm file routes to /?visit=comp
But I gathered that search engines don’t like links that are opened via Java Script.
Thx for any help, it would be greatly aprechiated.
Kind Regards, Jan
When we have a website that uses variables in the domain names, we usually
use a system called Mod Rewrite on a Linux/Apache/mySQL/PHP (LAMP) server
to make more user-friendly URLs. This doesn’t work the same a Windows IIS
server, but works well on a LAMP server. Most websites nowadays are on LAMP
It works like this:
In the .htaccess file put these lines for each of the pages of the site.
(Contact a web programmer for a quote on doing this if it is beyond your
technical skills — it should be fairly fast and cheap to get done.)
RewriteRule ^airport.php /community.php?unit=airport.php&language=english [L]
You only need to tell it “
RewriteEngine On” once. For every page you want to rewrite like this, you add another line.
So when someone goes to airport.php, what they actually get is the community.php page, with all its variables. What Google “sees” is airport.php. What a visitor “sees” in his browser address bar is airport.php.
What’s actually displaying to both Google and your visitor is
This allows you to have a shorter URL that is more search engine friendly.
Here’s a better example:
RewriteRule ^big-green-widgets.php /product-display.php?productid=widgets&productstyle=blue&productsize=big[L]
There IS no page named
big-green-widgets.php on the server. (Like Neo learns in The Matrix movie, “There is no spoon.”)
The server sees a request for the page “
big-green-widgets.php” and because of this line in the .htaccess file, the server goes and gets the info it
needs to create the page on-the-fly.
big-green-widgets.php“. Even if that actually mod rewrites over to
www.dom.ain/?visit=cat1324, it doesn’t matter. As far as Google and your visitors are concerned, you have a page called big-green-widgets.php.
Mod rewrite is a wonderful tool for anyone trying to optimize a site that is built using only a single page with variables, or using a long string of variables and a database.
Website Design & Marketing / SEO