0

My team is developing a new website to offer "Online tour Registration" services for a company. While designing tours page, We were discussing how to create a URL for every tour such a way that everyone can understand it and on the other hand it make sense for search engines.

So we started to analyse different ways to implement a Beautiful URL. Consider that every tour can be recognized by a unique ID, So, an example tour URL may be something like this:

http://www.example.com/tour/0x5P8btUJSo58LFh9Ukm114613052846

where 0x5P8btUJSo58LFh9Ukm114613052846 is the UNIQUE ID of the tour. The Question is, How to add Origin and Destination names is URL so everyone can understand the locations of the tour only by viewing the URL. What will you suggest? If we add origin and destination in URL, How different tours with the same destinations and origins will be declared? How adding Origin and Destination will effect on SEO and appearing in search results?

Iman
  • 533
  • 2
  • 8
  • 23

3 Answers3

1

I'd use Apache Mod_Rewrite to rewrite all URLs of the /tour/ directory to a single script, with a query string to pass the requested path to the script.

/tours/.htaccess:

RewriteEngine On
RewriteRule ^/?tours/?(.*)$ index.php?q=$1 [NC,L]

Then, in index.php, have it handle $_GET['q']'s data in whatever format you wish. This way you can still keep any links to your current pages, but also accept the new format.

To differentiate between the different tours, I'd run a format like:

http://www.example.com/tours/Origin/Destination/TourID

Maybe make TourID a much smaller string, or even customized by the group who booked the tour.

Mat Carlson
  • 543
  • 3
  • 12
  • Thank you, so you would recommend `http://www.example.com/tours/Origin/Destination/TourID` format. But `Origin` and `Destination` are not necessary - and making only URL beautiful -, 'cause TourID is actually enough to call the tour. – Iman Nov 20 '13 at 16:08
  • I put the TourID location in so you are able to add a unique ID - Is that what you wanted, to differentiate between different tours with the same origin and destination? – Mat Carlson Nov 20 '13 at 16:11
  • Thanks, I'm agree with you. (I'm wondering if there is another way to do this.) – Iman Nov 20 '13 at 16:16
  • Ah - Ok. What way would you prefer? – Mat Carlson Nov 20 '13 at 17:08
  • till now, the way you mentioned here, I'm working on it yet ;) – Iman Nov 20 '13 at 17:36
1

Why not put the date in the URL, too?

And you could omit the ID, if origin + destination + date is unique in your case; if not, add the departure time, too.

Various designs are possible, e.g.,:

example.com/tour/paris-to-madrid/2013-11-25
example.com/tour/paris/madrid/2013-11-25
example.com/tour/2013-11-25/paris-to-madrid/
example.com/tour/2013-11-25/paris/madrid/

I’d chose one that allows browsing by URL path manipulation. For example, if you have a list with all tours on a specific day, use the date first (example.com/tour/2013-11-25/ shows all tours on 2013-11-25); if you want to show all available tour dates for a specific tour, use the tour first (example.com/tour/paris-to-madrid/ shows all tours from Paris to Madrid); etc.

I think it’ pretty obvious that such a readable URL is more friendly than using a cryptic ID. Which link are you more likely to click, and which one gives some information before even visiting the page?

  • example.com/tour/paris-to-madrid/2013-11-25
  • example.com/tour/0x5P8btUJSo58LFh9Ukm114613052846

If you’d include the ID in addition to the readable parts, the URL would get very long, and the ID would still distract from the important parts:

  • example.com/tour/0x5P8btUJSo58LFh9Ukm114613052846/paris-to-madrid/2013-11-25
unor
  • 92,415
  • 26
  • 211
  • 360
0

You would need .htaccess if you're using Apache

Maybe something like

Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteBase /

RewriteRule ^/?tour/([a-zA-Z_]+)/([a-zA-Z_]+)$ tour.php?origin=$1&destination=$2 [NC,L]
AdRock
  • 2,959
  • 10
  • 66
  • 106