Not sure if this is attainable - SEO 'friendly' URL rewrite

Discuss practical ways rearrange URLs using mod_rewrite.

Not sure if this is attainable - SEO 'friendly' URL rewrite

Postby skygod12000 » Sat Sep 05, 2009 8:03 am

I can only make changes to the .htacess file as our domain is on a hosted server with no acess to httpd.conf

I am now trying to make our URLs more Search Engine 'friendly' using keywords such as 'house' and 'rent' instead of values of 14 and 2

This is a live site which has just migrated from a flatform database to a relational database and now some SEO is required. I have tried following different examples posted as solutions to other forum user problems, but as I only have a 'live' domain to work with, I am reluctant to try too many attempts at DIY 'suck it and see' coding, as I've generated far too many 500 server errors (admittedly only for a short time) which could detract visitors.


At present, a search for all properties takes the form
http://my.domain/?p=search&lang=&id_typ ... formprice=

and when using my pagination

http://my.domain/?p=search&lang=&id_typ ... ce=&page=1

The elements formprice, lang, beds baths and page are not relevant to the SEO requirements so do not require conversion and can simply be added as <parameters>

A form generated search adds values to individual elements

All houses
http://my.domain/?p=search&lang=&id_typ ... formprice=

If necessary, I can change the id_type=14 using php to be id_type=house

Ideal SEO URL would be
http://my.domain/house/<parameters>.php

All Houses for Sale
http://my.domain/?p=search&lang=&id_typ ... e=all_sale

If necessary, I can change the id_type=14 using php to be id_type=house
If necessary, I can change the id_for=1 using php to be id_for=sale

Ideal SEO URL would be
http://my.domain/house for sale/<parameters>.php

All Houses for Rent
http://my.domain/?p=search&lang=&id_typ ... e=all_rent
If necessary, I can change the id_type=14 using php to be id_type=house
If necessary, I can change the id_for=2 using php to be id_for=rent

Ideal SEO URL would be
http://my.domain/house for rent/<parameters>.php

All Houses for Sale in Location
http://my.domain/?p=search&lang=&id_typ ... e=all_sale
If necessary, I can change the id_type=14 using php to be id_type=house
If necessary, I can change the id_for=1 using php to be id_for=sale
If necessary, I can change the id_location=13 using php to be id_location=city

Ideal SEO URL would be
http://my.domain/house for sale in city/<parameters>.php

Not sure what I have in my Paypal account at the moment or how to top it up from Thailand, but a donation to this site WILL be made if this can be resolved.
skygod12000
 
Posts: 8
Joined: Wed Aug 05, 2009 3:13 am

Postby richardk » Sat Sep 05, 2009 8:34 am

This is a live site which has just migrated from a flatform database to a relational database and now some SEO is required. I have tried following different examples posted as solutions to other forum user problems, but as I only have a 'live' domain to work with, I am reluctant to try too many attempts at DIY 'suck it and see' coding, as I've generated far too many 500 server errors (admittedly only for a short time) which could detract visitors.

Set up a test server. WAMP, XAMPP, etc.

If necessary, I can change the id_location=13 using php to be id_location=city

Does city change?

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^house/(.+)\.php$ /?p=search&id_type=14&$1 [QSA,L]

RewriteRule ^house-for-sale/(.+)\.php$ /?p=search&id_type=14&id_for=1&$1 [QSA,L]

RewriteRule ^house-for-rent/(.+)\.php$ /?p=search&id_type=14&id_for=2&$1 [QSA,L]

RewriteRule ^house-for-sale-in-city/(.+)\.php$ /?p=search&id_type=14&id_for=1&id_location=13 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Have installed xampp on localhost

Postby skygod12000 » Sat Sep 05, 2009 8:56 am

Richard,

I have downloaded and installed xampp for windows. I have exported (and imported) the live database and am currently copying all the scripts and image data from the live server (c.1Gb backup over a public access wireless 512kb download line) so that I can test effectively on 'localhost' without impacting the live server.

In answer to your question, the 'location' can change. At present it can represent 'West', 'East', 'Central', 'Suburbs', however other town names may be used in the future.


I am seriously in awe at how you completely understand what has proven to be one of the real 'black arts' of web development.

I bow to your knowledge and offer you a 'wai' as my superior and master in the art.

George
skygod12000
 
Posts: 8
Joined: Wed Aug 05, 2009 3:13 am

Postby richardk » Sun Sep 06, 2009 3:16 pm

Replace
Code: Select all
RewriteRule ^house-for-sale-in-city/(.+)\.php$ /?p=search&id_type=14&id_for=1&id_location=13 [QSA,L]

with
Code: Select all
RewriteRule ^house-for-sale-in-([a-zA-Z]+)/(.+)\.php$ /?p=search&id_type=14&id_for=1&id_location=$1&$2 [QSA,L]

and you will need to do this
If necessary, I can change the id_location=13 using php to be id_location=city
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 17 guests

cron