Jump to content

Recommended Posts

Hi There

 

I designed a database driven site some years ago using PHP and HTML. All the site pages are routed through index.php and the content of those pages is determined by the query string in the URL which then triggers PHP includes.

 

I am now at a stage where we have a SEO company who has advised us to make our URL's "SEO friendly". They advise that the best way to do this is using 301 redirects and using the mod_rewrite feature on the Apache Server.

 

I have no experience whatsover with this. What is the best way to go about this? I have googled mod_rewrite etc. but there is so much information I don't know what the best way to proceed is. Below is an example of what I want to achieve across the site:

 

Existing URL: http://www.mycompany.co.uk/index.php?page=show_range&range_id=39

 

Proposed URL: http://www.mycompany.co.uk/ranges/balmoral

 

If anyone can offer any advice for best practice I would most appreciate, or even a link to a good tutorial that would be great!

 

Thanks in advance,

 

Craig

From an application I am very familiar with, this is the approach taken:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)\.html?$ index.php?seo_path=$1 [L,QSA]

Given:

http://www.mycompany.co.uk/ranges/balmoral.html

if this isn't an existing file or directory, take ranges/balmoral and set it as the value of the querystring key seo_path. The result will be:

http://www.mycompany.co.uk/index.php?seo_path=ranges/balmoral

Query a database table holding all the derived paths for the matching item and item_id:

| ranges/balmoral | show_range | 39 |

 

Hi, thanks for the advice. Before I go and experiment with that, I have been informed I need to do 301 redirects so not only do the URL's look more frindly, but Google will be aware that they have moved permanently. How do I build that in to the equation?

I don't know how one would code massive amounts of ReWrite .htaccess statements (the following is only representative and not syntactically correct):

if (39) then (balmoral)

if ...

if ...

[301 whatever]

 

The users of the application I mentioned have created a site map, told Google to dump all previous indexed scans, and submitted that sitemap. This is in Google's Webmaster Tools.

 

I have no practical answer on how to implement an immediate solution.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.