Buy Sell Discuss UK Domain Names at AcornDomains.co.uk Domain Sponsor

Today's Drop Dates are: 19-02-2012 or 26-02-2012   All times are GMT. The time now is 01:40:58 PM.
Domain Name Sales Domain Software Calculate UK Domain Drop Dates Domain Registration NameDrive Domain Parking Subscribe to our Domains For Sale newsletter
Go Back   Domain Forum Acorn Domains Buy Sell Auction UK Domains > Website Design and Promotion > Website Design
Connect with Facebook

Website Design Discuss web design

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 17-11-2009, 01:35:49 PM     #11 (permalink)

 
Skinner's Avatar
 
Join Date: Jul 2008
Location: Manchester
Posts: 2,507
Skinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond repute

My RegEx is limited too, the one member I introduced to the forum who was very very good at regex was chased away and stoned like a martyre and refuses to come on the forum now.

The multiple rules allow you to determin which is it.

RewriteEngine on
RewriteRule ^search/(.*)/town/(.*)/(.*) sample.php?function=search&type=$1&town=$2&page=$3
RewriteRule ^search/(.*)/county/(.*)/(.*) sample.php?function=search&type=$1&county=$2&page= $3

Then in PHP test page and set to 0/1 if not set.

Write a rule for each one, it the 'easiest' option, I expect more advanced regex as possible but they are beyond my basic understanding of it.

Something like that may work.
__________________
Browse:
Skinner is offline  
Old 17-11-2009, 01:42:57 PM     #12 (permalink)

 
Join Date: May 2007
Posts: 1,148
monaghan has a reputation beyond reputemonaghan has a reputation beyond reputemonaghan has a reputation beyond reputemonaghan has a reputation beyond reputemonaghan has a reputation beyond reputemonaghan has a reputation beyond reputemonaghan has a reputation beyond reputemonaghan has a reputation beyond reputemonaghan has a reputation beyond reputemonaghan has a reputation beyond reputemonaghan has a reputation beyond repute

time to "fiddle" I think

I used to use a number of complex regex's in Unix print filters piping via sed & awk about 15-20 years ago so we could share printers on the mini's with the PC's, but I'm quite rusty these days
__________________
Alex Monaghan - Drop Catch & Drop Lists - PM for details
Online Accounting|Pine Furniture|Barbie
monaghan is offline  
Old 17-11-2009, 03:07:30 PM     #13 (permalink)

 
expertc's Avatar
 
Join Date: Apr 2009
Posts: 929
expertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond repute

Why not use the simple way like:

ErrorDocument 404 /index.php

and then do the rest of coding in php? In this case variable is passed, and you can easily add extra redirections if needed. This is the way some url shortening services work, when giving <domain>/<short> redirection.
__________________
Car Stereo Systems <> Insulation Materials <> Men's White Jeans <> Discount Laptops ...and many more for sale. Make me an offer ;)
expertc is offline  
Old 17-11-2009, 07:42:38 PM     #14 (permalink)

 
Skinner's Avatar
 
Join Date: Jul 2008
Location: Manchester
Posts: 2,507
Skinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond repute

I'm on my not so smart phone so this may come out as more crap than usual.

If you rely on your error handler to do this, you wouldn't realistically and reliably be able to determine what was an error, what was a legit request and what was someone trying to inject.

Aside from the best practice and good form issues.

You would need php to parse and split the current path to convert it into chunks then push the pieces into variables then operate on them to determine search or show etc, then produce your page. I think i got that right its hard to tell when you can only see 50 to 70 characters at a time

A busy site would eat a shared resource server alive first in processor time then in memory.

Least thats if i understood your meaning.
__________________
Browse:
Skinner is offline  
Old 17-11-2009, 07:58:21 PM     #15 (permalink)

 
expertc's Avatar
 
Join Date: Apr 2009
Posts: 929
expertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond repute

Quote:
Originally Posted by Skinner View Post
I'm on my not so smart phone so this may come out as more crap than usual.

If you rely on your error handler to do this, you wouldn't realistically and reliably be able to determine what was an error, what was a legit request and what was someone trying to inject.

Aside from the best practice and good form issues.

You would need php to parse and split the current path to convert it into chunks then push the pieces into variables then operate on them to determine search or show etc, then produce your page. I think i got that right its hard to tell when you can only see 50 to 70 characters at a time

A busy site would eat a shared resource server alive first in processor time then in memory.

Least thats if i understood your meaning.
It depends on how you handle the error. You don’t need to parse (as far as I can see form the task) but simply query the path (as a single variable) against database or, if not many redirects are needed, against text file. The redirect is also stored in the database or text. So we are talking about single command, if FALSE is returned, send to 404. Not really resource-hungry in this way. Meanwhile for many redirects or possible redirects you will get quite hefty .htaccess and this will slow the system down.

P.S. If you need just 1-2 redirects, you can even "hardcode" them into index.php so no database is needed.
__________________
Car Stereo Systems <> Insulation Materials <> Men's White Jeans <> Discount Laptops ...and many more for sale. Make me an offer ;)

Last edited by expertc; 17-11-2009 at 08:11:14 PM. Reason: Other Option added
expertc is offline  
Old 17-11-2009, 08:39:31 PM     #16 (permalink)

 
Skinner's Avatar
 
Join Date: Jul 2008
Location: Manchester
Posts: 2,507
Skinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond reputeSkinner has a reputation beyond repute

I can't see how you could not parse it when the function would accept search, view, show or whatever else so you would need to split out the function, the search function then accepts either county or town, maybe even city so you'd need to work that out. On top of this you have an optional variable of page to check.

I guess you could do like url shortening scripts do, the last one i worked on basically took the first x characters after the / ran a query then returned based on those characters but with 1000s of towns/city/counties it would call ache.

I think i'm misunderstanding what your idea is. I'm sure if you've done it, it works but i can't visualise the code or methods and not near an interpreter to try it.

My suggestion is half a dozen rewrite rules that matches each distinct set. 1 for county, 1 for city, 1 for town, 1 for view etc, with 1 test and set for page.

I'm sure you could use the or operator in regex to town||city||county etc to reduce the lines too.
__________________
Browse:
Skinner is offline  
Old 17-11-2009, 09:02:41 PM     #17 (permalink)

 
expertc's Avatar
 
Join Date: Apr 2009
Posts: 929
expertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond reputeexpertc has a reputation beyond repute

Quote:
Originally Posted by Skinner View Post
I can't see how you could not parse it when the function would accept search, view, show or whatever else so you would need to split out the function, the search function then accepts either county or town, maybe even city so you'd need to work that out. On top of this you have an optional variable of page to check.

I guess you could do like url shortening scripts do, the last one i worked on basically took the first x characters after the / ran a query then returned based on those characters but with 1000s of towns/city/counties it would call ache.

I think i'm misunderstanding what your idea is. I'm sure if you've done it, it works but i can't visualise the code or methods and not near an interpreter to try it.

My suggestion is half a dozen rewrite rules that matches each distinct set. 1 for county, 1 for city, 1 for town, 1 for view etc, with 1 test and set for page.

I'm sure you could use the or operator in regex to town||city||county etc to reduce the lines too.
It's just fine with rewrites, not a problem. I think we probably talking about different tasks. I suggested simple handler like this (not a complete code but gives an idea):

function line_redirect($line) {
global $dbcheck;

$qry = "SELECT * FROM $dbcheck WHERE id = '$line';";
$out = mysql_query($qry) or die ("Error: Query failed");

$rows = mysql_num_rows($out);
if (($rows != 0) && (mysql_result($out, 0, "url") != "")) {


<put whatever you need here, like redirects>


}

<real 404 here>

Maybe we are talking about different redirect types?
__________________
Car Stereo Systems <> Insulation Materials <> Men's White Jeans <> Discount Laptops ...and many more for sale. Make me an offer ;)

Last edited by expertc; 17-11-2009 at 09:35:53 PM. Reason: typo
expertc is offline  
Closed Thread



Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Domain Name Community Replies Last Post
.htaccess help SecNam Website Design 1 07-09-2009 01:42:31 AM
URL Rewrite GeoMal Services Wanted 2 06-02-2009 09:20:25 AM
Mod Rewrite assistance grantw Search Engine Optimisation 5 23-12-2007 10:08:43 AM
mod rewrite anyone? SecNam Search Engine Optimisation 6 03-08-2007 01:35:03 PM
catch all with .htaccess stevie General Board 4 05-10-2006 10:19:43 PM

Web Hosting from UK2 from just 99p


All times are GMT. The time now is 01:40:58 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.0 RC 2
All content on Acorn Domains is member generated and is not moderated before posting. All content is viewed and used by you at your own risk and AD does not warrant the accuracy or reliability of any of the information. The views expressed are those of the individual contributors and not necessarily those of AD. Please contact us to report any issues or send a PM to "Admin".