The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 22, 2019, 11:51:01 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Mod Re-write help... some of the string is missing...  (Read 3608 times)
tommytx
Expert
****
Offline Offline

Posts: 123


View Profile WWW
« on: October 31, 2013, 09:38:30 PM »

What I am trying to do is jump over to a temp directory named /re-old/ and have the index.php file grab out the Mls # 81134733 and then do a 303 Redirect to mydomain.com/81134733/
IF I can get the entire url into teh index.php file above.. I will have no problem parsing for the MLS # and then doing 301 redirect... but with what I have the only thing being passed to the index.php via the $1 is simply "/schedule-showing/" so since I cannot figure out the code to transfer the MLS number to the index.php I cannot parse it.... matter of fact the only thing I need to send to the index.php is the mls number... but only the "/schedule-showing/'  is going across...

Current htaccess file
RewriteEngine On
RewriteBase /
RewriteRule forms(.*) re-old/index.php?dat=$1

Below is a sample url of which there is several hunderd each having a unique MLS number....

Code:
mydomain.com/forms/schedule-showing/?showdate=true&address=22680 E Cliff Dr #2, Santa Cruz, CA 95062(MLS # 81134733)&iframe=true&width=450&height=500

Thanks for any help....

Basically to simplify I need the below..
Simply do a 301 redirect of the long URL to a simple mydomain.com/811347733/
However the only way I know to parse and get the mls # is to first redirect to the index.php for parsing the MLS # out of the long URL.


Logged
Bompa
Administrator
Lifer
*****
Offline Offline

Posts: 564


Where does this show?


View Profile
« Reply #1 on: November 01, 2013, 01:07:46 AM »

You're going to have a problem with that URL.

But first, just try this in htaccess:

RewriteRule forms your_script.php

Then in your script, display the REQUEST_URI

Logged

"The most beautiful and profound emotion we can experience is the sensation of the mystical..." - Albert Einstein
tommytx
Expert
****
Offline Offline

Posts: 123


View Profile WWW
« Reply #2 on: November 01, 2013, 08:02:06 AM »

I have tried that.. but none of the variables have the data I need.. that is the part with the MLS #.. not even the query..

/forms/schedule-showing/?showdate=true&address=22680 E Cliff Dr #2, Santa Cruz, CA 95062(MLS # 81134733)&iframe=true&width=450&height=500

Here is what the results look like.
**************************
$uri = $_SERVER["REQUEST_URI"];
$qery = $_SERVER["QUERY_STRING"];

Live Results
*********
URI = /forms/schedule-showing/?showdate=true&address=22680%20E%20Cliff%20Dr%20
QERY = showdate=true&address=22680%20E%20Cliff%20Dr%20

So I will be on my way if I can find a way to transfer the MLS # portion of the url to the script for parsing.

The interesting part is that I have a redirect plugin monitoring for any 404 errors and that file is logging the full URL into the mysql data base.. so I am not sure what they are saving to mysql.. but it is clearly the entire URL...matter of fact that is how I am getting the full urls that I need to redirect.  The redirect program is pretty complex so I have not been able to look at the code to determine what actual variable they saving..
I have been trying to follow the WP plugin.. redirect but not been able to find it at this point.

So bottom line there has to be a way to capture that portion of the url..... I just cannot find it..

I have even gone so far as to run this sucker on myscript.php to see if the MLS number would show up in any variable what so ever and it never showed at all... Any where... wow .. it can't be this hard... while the redirect plugin grabs the entire url without a problem..



Code:
<?php
 $indicesServer 
= array('PHP_SELF',
'argv',
'argc',
'GATEWAY_INTERFACE',
'SERVER_ADDR',
'SERVER_NAME',
'SERVER_SOFTWARE',
'SERVER_PROTOCOL',
'REQUEST_METHOD',
'REQUEST_TIME',
'REQUEST_TIME_FLOAT',
'QUERY_STRING',
'DOCUMENT_ROOT',
'HTTP_ACCEPT',
'HTTP_ACCEPT_CHARSET',
'HTTP_ACCEPT_ENCODING',
'HTTP_ACCEPT_LANGUAGE',
'HTTP_CONNECTION',
'HTTP_HOST',
'HTTP_REFERER',
'HTTP_USER_AGENT',
'HTTPS',
'REMOTE_ADDR',
'REMOTE_HOST',
'REMOTE_PORT',
'REMOTE_USER',
'REDIRECT_REMOTE_USER',
'SCRIPT_FILENAME',
'SERVER_ADMIN',
'SERVER_PORT',
'SERVER_SIGNATURE',
'PATH_TRANSLATED',
'SCRIPT_NAME',
'REQUEST_URI',
'PHP_AUTH_DIGEST',
'PHP_AUTH_USER',
'PHP_AUTH_PW',
'AUTH_TYPE',
'PATH_INFO',
'ORIG_PATH_INFO') ;

echo 
'<table cellpadding="10">' ;
foreach (
$indicesServer as $arg) {
    if (isset(
$_SERVER[$arg])) {
        echo 
'<tr><td>'.$arg.'</td><td>' $_SERVER[$arg] . '</td></tr>' ;
    }
    else {
        echo 
'<tr><td>'.$arg.'</td><td>-</td></tr>' ;
    }
}
echo 
'</table>' ;


Logged
Bompa
Administrator
Lifer
*****
Offline Offline

Posts: 564


Where does this show?


View Profile
« Reply #3 on: November 01, 2013, 02:28:32 PM »

I have tried that.. but none of the variables have the data I need.. that is the part with the MLS #.. not even the query..

/forms/schedule-showing/?showdate=true&address=22680 E Cliff Dr #2, Santa Cruz, CA 95062(MLS # 81134733)&iframe=true&width=450&height=500

Here is what the results look like.
**************************
$uri = $_SERVER["REQUEST_URI"];
$qery = $_SERVER["QUERY_STRING"];

Live Results
*********
URI = /forms/schedule-showing/?showdate=true&address=22680%20E%20Cliff%20Dr%20
QERY = showdate=true&address=22680%20E%20Cliff%20Dr%20

Tommy, it's not showing because it's NOT there.  Trust me on this one.  Actually,
you don't need to trust me.  Open LiveHeaders for FF and watch what is being requested.

Notice where it gets cut off?  At the # symbol. The # symbol in a URL is called a fragment identifier.

How it works:
Basically, the browser saves everything to the right of the # symbol without sending that
fragment over the internet.  Then the browser loads the page, then the browser tries to
find that fragment on the loaded page.

Quote
Fragments depend on the document MIME type and are evaluated by the
client (Web browser). Clients are not supposed to send URI-fragments to
servers when they retrieve a document, and without help from a local
application (see below) fragments do not participate in HTTP redirections
http://en.wikipedia.org/wiki/Fragment_identifier


Quote
The interesting part is that I have a redirect plugin monitoring for any 404 errors and that file is logging the full URL into the mysql data base.. so I am not sure what they are saving to mysql.. but it is clearly the entire URL...matter of fact that is how I am getting the full urls that I need to redirect.  The redirect program is pretty complex so I have not been able to look at the code to determine what actual variable they saving..
I have been trying to follow the WP plugin.. redirect but not been able to find it at this point.

That script is on the same site as the original URL.

Quote
So bottom line there has to be a way to capture that portion of the url..... I just cannot find it..

Remove the #


Bompa
« Last Edit: November 01, 2013, 02:51:22 PM by Bompa » Logged

"The most beautiful and profound emotion we can experience is the sensation of the mystical..." - Albert Einstein
tommytx
Expert
****
Offline Offline

Posts: 123


View Profile WWW
« Reply #4 on: November 02, 2013, 08:14:32 AM »

Easier said than done...since I have no idea where google is dredging up those urls... I have no control over the # sign which is part of the MLS # in the url.... Is there anyway I can remove it in the htaccess... or does it never reach the htaccess....

Now here is the funny.. obviously there is a way to capture it since the redirection plugin captures and saves it...
I am getting about a hundered a day into mysql being saved by the plugin... which is reporting them of course as a 404 error..

Matter of fact if the Mysql was not saving this full URL with the # sign I would not even know it was in the incoming package....
Its there in the URL and somehow when the full url is captured its now in the mysql....

Not sure if I can figure out a way to let it go to the mysql... then look in the mysql and parse out the mls # part and then command google a 301 to the new url based on the plugin grabbing the url for me... wow this is getting complicated..

Wish I knew PHP better as I would study the plugin in and try to find out where the call to store the newfound 404 is in the php and at that time parse and commmand a 301....

Help!
anyone willing to look at the PHP to see if you can detect where the actual 404 processing is being done.. if so it would be a simple matter to do the 301 at that point.... will be happy to send the code if anyone wants to look.. or you can download the plugin yourself....

But trust me Bompa... if the # was not capturable by some method.. I would not know about it ... since I found it in the mysql after being saved....

Thanks for the help so far....
Logged
tommytx
Expert
****
Offline Offline

Posts: 123


View Profile WWW
« Reply #5 on: November 02, 2013, 08:18:12 AM »

Is it possible the plug in writer.... actually saw this problem also and grabbed the missing portion from the header and added it back to the URL... Wow! what progressive work.... I doubt that actually happened...

But here is another thought... is there anyway I can get the MLS # from the header since that is all I need to make this work... I plan to trash the rest of the entire url keeping only the MLS # XXXXXXXX and rewrite..... must be some way... man made it man can fix it.... HaHa.
Logged
tommytx
Expert
****
Offline Offline

Posts: 123


View Profile WWW
« Reply #6 on: November 02, 2013, 08:23:14 AM »

URI = /forms/schedule-showing/?showdate=true&address=22680%20E%20Cliff%20Dr%20

/forms/schedule-showing/?showdate=true&address=22680 E Cliff Dr #2, Santa Cruz, CA 95062(MLS # 81134733)&iframe=true&width=450&height=500

Based on careful inspection of the URI being transferred to my script file... it looks like the actual cutoff occurred at the parenthesis (
since nothing past the %20 at the end of the URI occurred.. so it transferred up the the actual space (%20) just before the parenthesis (
and not transferring even the ( MLS either...)  anythoughts on that... seems like it never even got close to the # before shutdown...
Just pulling at straws......

Logged
tommytx
Expert
****
Offline Offline

Posts: 123


View Profile WWW
« Reply #7 on: November 02, 2013, 03:16:02 PM »

Hey Bompa... just noticed this..

<bompa quote>That script is on the same site as the original URL.</quote>

Not sure if I understand what you are saying here... I have no idea where the original URL is being generated... I am assuming it is something that google has in their index.. however i cannot find it in the index of google anywhere using the site: command... but in any case its coming from google at a rate of maybe 100 hits per day and the only way I get to see the full url is when a redirect plugin that i have on my blog identifes the url as a 404 error and saves this entire url including the # sign in the mysql... So my mysql is filling up with an additional 100 of these suckers each day...

So I have no idea what you mean by the statement... script and original URL on same site?
Can you expound... that might help me understand..

right now.. with no other options... I am studying the redirection plugin... trying to find how the plugin was able to capture the entire url and save it to mysql... but not  being a super hot php guy finding it may be a challenge for me..

« Last Edit: November 02, 2013, 03:18:11 PM by tommytx » Logged
Bompa
Administrator
Lifer
*****
Offline Offline

Posts: 564


Where does this show?


View Profile
« Reply #8 on: November 02, 2013, 04:20:49 PM »

Hey Bompa... just noticed this..

<bompa quote>That script is on the same site as the original URL.</quote>


You keep saying that it must be possible to capture it, but, if it's not there, it's not there.

I am guesssing that your script that is showing 404s is seeing the same truncated
URL that I see:

/forms/schedule-showing/?showdate=true&address=22680%20E%20Cliff%20Dr%20

Then it find that in the database and uses the URL listed in the database.


Just guessing on that, but everything from the # on, will never make it to .htaccess.

This much is very easy to prove.


Bompa
Logged

"The most beautiful and profound emotion we can experience is the sensation of the mystical..." - Albert Einstein
tommytx
Expert
****
Offline Offline

Posts: 123


View Profile WWW
« Reply #9 on: November 03, 2013, 12:07:32 PM »

Nope....(its not capturing a partial)  I have shown the full url being captured by the onsite redirect/404 plugin... several times above.... here it is again.. and about 100 per hour come in... and I wish to hell google would quit dredging these up.. but its making my tool box look bad... and the google webmaster toolbox is capturing the full url # signs and all.... the whole shebang..

This is found in the GWT box.. and in the 404 mysql for the plugin....
**************************************************
/forms/schedule-showing/?showdate=true&address=22680 E Cliff Dr #2, Santa Cruz, CA 95062(MLS # 81134733)&iframe=true&width=450&height=500

As you can see somehow its bringing in the full URL with the # sign in tack at "Dr #2" and again at "MLS #"  so its beyond me how its getting the rest of the url if its not there....... you see if something on board did not capture the whole thing... i would have no idea that long url even existed..
You can't make this stuff up (the url)

So anyway.. guess I will continue trying to reverse engineer the plugin to see where they are capturing the url... and then I will be able to do it also...

But thanks for trying to help.....



Logged
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!