oracle765 Posted December 8, 2014 Share Posted December 8, 2014 Hi Professionals I am currently going through the process of grading my website in MOZ tools and getting over 2000 URLs to crawl errors The url I have is currently www.myurl.com.au/hotel_details.php?hotel_id=358705¤cy_code=AUD&q=%27%3A%2F%2Fwww.travelnow.com%2Ftemplates%2F451536%2Fhotels%2F358705%2Foverview%3Flang%3Den%26amp%3Bcurrency%3DAUD%26amp%3BstandardCheckin%3D12%2F17%2F2014%26amp%3BstandardCheckout%3D12%2F18%2F2014%26amp%3BroomsCount%3D1%26amp%3Brooms[0].adultsCount%3D2%27&price=149&totlday=1 How or where would I go about re-writing this I am not a professional with PHP and I have never done anything like this before Thanks in advance Quote Link to comment Share on other sites More sharing options...
requinix Posted December 8, 2014 Share Posted December 8, 2014 What is the q for? Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted December 8, 2014 Share Posted December 8, 2014 You do it with apache rewrite rules in .htaccess Here is a generator online http://www.generateit.net/mod-rewrite/index.php I think your main concern is the q parameter value is a mess I'm assuming It's always going to be different and those seem what is long Is more to this, your application also needs to interpret the new url correctly Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted December 8, 2014 Share Posted December 8, 2014 Maybe you should save these urls for the q to a db and pull them in your script with an id example www.myurl.com.au/hotel_details.php?hotel_id=358705¤cy_code=AUD&q=64723 If you are trying to get dynamic urls appended as your own permanent links will most likely always run into this problem or others Quote Link to comment Share on other sites More sharing options...
oracle765 Posted December 11, 2014 Author Share Posted December 11, 2014 hi there sorry as my internet has been down for 2 days the q is a variable where the urls are stored which are dynamic for every hotel Quote Link to comment Share on other sites More sharing options...
oracle765 Posted December 11, 2014 Author Share Posted December 11, 2014 <?php require_once('config/config.php'); require_once('files/hotel_form_check.php'); $hotel_id = $_GET['hotel_id']; $currency_code = $_GET['currency_code']; $pr = $_GET['price']; if($pr!="") { $h_price = $currency_code." ".$pr ; } $u = urldecode($_GET["q"]); $n_url = str_replace("'","",$u); $store_url = "http".$n_url ; $timestamp = gmdate('U'); $secret = 'NOT-SHOWN'; $apiKey = 'TEST'; $cid = 'HIDDEN'; $sig = md5($apiKey . $secret . $timestamp); $url2 = 'http://api.ean.com/ean-services/rs/hotel/v3/info?minorRev=26'; $url2 .='&apiKey='.$apiKey.''; $url2 .='&cid='.$cid.'&sig='.$sig.''; $url2 .='¤cyCode='.$currency_code.'&hotelId='.$hotel_id.''; $header[] = "Accept: application/json"; $header[] = "Accept-Encoding: gzip"; $ch3 = curl_init(); curl_setopt( $ch3, CURLOPT_HTTPHEADER, $header ); curl_setopt($ch3,CURLOPT_ENCODING , "gzip"); curl_setopt($ch3, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt( $ch3, CURLOPT_URL, $url2 ); curl_setopt( $ch3, CURLOPT_RETURNTRANSFER, true ); $respon = json_decode(curl_exec($ch3), true); // //echo "<pre>"; //print_r($respon); //exit(); $res = "select * from CountryList where `CountryCode` = '".$respon['HotelInformationResponse']['HotelSummary']['countryCode']."' limit 1"; $sql=mysql_query($res); $row=mysql_fetch_array($sql); $country_name = $row['CountryName']; //SEO TITLES AND META DESC // $title_tag = $respon['HotelInformationResponse']['HotelSummary']['name'] ; $city_country_tag = $respon['HotelInformationResponse']['HotelSummary']['city']; $title .= $title_tag. " - " .$city_country_tag; //$title .= " | Compare & Choose"; $check_header_length = strlen($title); if($check_header_length >= 35) { $title = $title; } elseif($check_header_length <= 35) { $title .= " | Compare & Choose";; } //<link href="//www.compareandchoose.com.au/hotel_details.php?cntry=' . $cntry . '&cntryname=' . $cn . '&city=' . str_replace(" ", "%20", $city1) . '" rel="canonical" /> // $meta = '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="'.$title_tag.'. Compare and Choose cheap hotel stays. '.$city_country_tag. " " .$country_name.' accomodation compared." /> <!-- MICROFORMATS FOR GPLUS --> <link href="https://plus.google.com/+CompareandchooseAuTravel/posts" rel="publisher" /> <meta itemprop="name" content="' .$title. '"> <meta itemprop="description" content="'.$title_tag.'. Compare and Choose cheap hotel stays. '.$city_country_tag. " " .$country_name.' accomodation compared."> <meta property="og:locale" content="en_US" /> <meta property="og:type" content="website" /> <meta property="og:title" content="' .$title. '" /> <meta property="og:description" content="'.$title_tag.'. Compare and Choose cheap hotel stays. '.$city_country_tag. " " .$country_name.' accomodation compared." /> <meta property="og:url" content="http://www.compareandchoose.com.au/" /> <meta property="og:site_name" content="Compare and Choose" /> <meta property="article:publisher" content="https://www.facebook.com/compareandchoose" /> <meta property="fb:app_id" content="1386609318277530" /> <meta property="og:image" content="http://www.compareandchoose.com.au/images/Compare-and-Choose-logo.png" /> <meta property="og:image:width" content="313" /> <meta property="og:image:height" content="75" />'; $part = new Body(); $head = $part->getHead($title,$meta); $header = $part->getHeader('Hotel'); $footer = $part->getFooter(); echo $head; echo $header; ?> <script type="text/javascript"> div = { show: function(elem) { document.getElementById(elem).style.visibility = 'visible'; }, hide: function(elem) { document.getElementById(elem).style.visibility = 'hidden'; } } </script> <link rel="stylesheet" type="text/css" href="css/elastislide.css" /> <script src="js/modernizr.custom.17475.js"></script> <div class="overlay_wrap" style="display: none;"></div> <div class="loader_hotel_page" style="display: none;"><img src="<?php echo SITE_URL; ?>images/search-loader.gif" alt="searching-records"/></div> <div class="container"> <div class="listing"> <div class="row"> <div class="col-xs-12 col-md-3 col-lg-3"> <div class="refine-search for-button"> <h1>Compare Hotel Prices</h1> <?php require_once('files/hotel_list_page_form.php'); ?> </div> </div> <div class="col-xs-12 col-md-9 col-lg-9"> <div class="page-title"> <h1><?php echo $respon['HotelInformationResponse']['HotelSummary']['name'] ;?></h1> <div class="details_rating"> <?php $rate = $respon['HotelInformationResponse']['HotelSummary']['hotelRating']; $f= floor($rate); $c = ceil($rate); if($rate!="" && $rate!=0) { for($in = 1; $in<=$rate ;$in++) { ?> <img src="images/star.png" alt="star-rating"> <?php } if($f != $c) {?> <img src="images/star_half.png" alt="half-star-rating"> <?php } } ?> </div> <div class="c1"></div> <p class="stay"><?php echo $respon['HotelInformationResponse']['HotelSummary']['address1']." , ";echo $respon['HotelInformationResponse']['HotelSummary']['city']." , " ; echo $country_name; ?></p> </div> <div class="row dtlsGalleryPan"> <div class="col-xs-12 col-md-6 col-lg-6 galImgDiv"> <div class="gallery"> <div class="image-preview"> <?php if($respon['HotelInformationResponse']['HotelImages']['HotelImage'][0]['url'] != "") { ?> <img id="preview" src="<?php echo $respon['HotelInformationResponse']['HotelImages']['HotelImage'][0]['url'] ;?>" alt="image-display" /> <?php } else {?> <img id="preview" src="images/no_img.gif" alt="preview-image" width="350" height="250" /> <?php } ?> </div> <!-- Elastislide Carousel --> <ul id="carousel" class="elastislide-list"> <!--<ul >--> <?php if($respon['HotelInformationResponse']['HotelImages']['HotelImage'] !="") { $i= 0; foreach($respon['HotelInformationResponse']['HotelImages']['HotelImage'] as $img) { $i++; ?> <li data-preview="<?php echo $img['url']; ?>" id="pr_<?php echo $i;?>"><a href="javascript:void(0);" ><img src="<?php echo $img['thumbnailUrl']; ?>" alt="image-preview" id="anc_<?php echo $i;?>" onMouseOver="div.show('div<?php echo $i ;?>')" onMouseOut="div.hide('div<?php echo $i ;?>')"/></a></li> <!--<li><img src="<?php echo $img['thumbnailUrl']; ?>" alt="" height="70" width="70" onMouseOver="div.show('div<?php echo $i ;?>')" onMouseOut="div.hide('div<?php echo $i ;?>')"/> <img src="<?php echo $img['url']; ?>" class="zoom-image" id="div<?php echo $i ;?>" alt="" style="visibility: hidden"/></li>--> <?php } ?> <!--</ul>--> </ul> <?php $i= 0; foreach($respon['HotelInformationResponse']['HotelImages']['HotelImage'] as $img) { $i++; ?> <img src="<?php echo $img['url']; ?>" class="zoom-image" id="div<?php echo $i ;?>" alt="" style="visibility: hidden"/> <?php } } ?> <!-- End Elastislide Carousel --> </div> </div> <div class="col-xs-12 col-md-6 col-lg-6 dtlsPrice"> <p class="night">Total <?php echo $_GET['totlday']; ?> Night</p> <div class="hotel-details"> <div class="price-box"> <div class="price"><?php echo $h_price; ?></div> </div> <a href="<?php echo $store_url ; ?>" class="book-now" target="_blank">Book Now</a> </div> </div> <div class="c1"></div> </div> <div class="row hotel-topics"> <div class="col-xs-12 col-md-12 col-lg-12"> <?php echo html_entity_decode($respon['HotelInformationResponse']['HotelDetails']['propertyDescription']); ?> </div> </div> <div class="row"> <div class="col-xs-12 col-md-12 col-lg-12"> <div class="hotel-features"> <h2>Hotel Features</h2> <div class="content"> <div class="hotel-topics"> <h1>Hotel Policy</h1> <p><?php echo $respon['HotelInformationResponse']['HotelDetails']['hotelPolicy'] ; ?></p> </div> <div class="hotel-topics"> <h1>Check-in</h1> <p>From <?php echo $respon['HotelInformationResponse']['HotelDetails']['checkInTime']; ?></p> </div> <div class="hotel-topics"> <h1>Check-out</h1> <p>Prior to <?php echo $respon['HotelInformationResponse']['HotelDetails']['checkOutTime'];?></p> </div> <div class="hotel-topics"> <h1>Property Information</h1> <p><?php echo $respon['HotelInformationResponse']['HotelDetails']['propertyInformation'];?></p> </div> <div class="hotel-topics"> <h1>CheckIn Instructions</h1> <p><?php echo $respon['HotelInformationResponse']['HotelDetails']['checkInInstructions'];?></p> </div> </div> </div> <div class="note"> Note : It is the responsibility of the hotel chain and/or the individual property to ensure the accuracy of the photos displayed. 'www.compareandchoose.com.au' is not responsible for any inaccuracies in the photos. </div> </div> </div> </div> <div class="c1"></div> </div> </div> </div> <script type="text/javascript" src="js/jquery.elastislide.js"></script> <script type="text/javascript"> // example how to integrate with a previewer var current = 0, $preview = $( '#preview' ), $carouselEl = $( '#carousel' ), $carouselItems = $carouselEl.children(), carousel = $carouselEl.elastislide( { current : current, minItems : 4, onClick : function( el, pos, evt ) { changeImage( el, pos ); evt.preventDefault(); }, onReady : function() { changeImage( $carouselItems.eq( current ), current ); } } ); function changeImage( el, pos ) { $preview.attr( 'src', el.data( 'preview' ) ); $carouselItems.removeClass( 'current-img' ); el.addClass( 'current-img' ); carousel.setCurrent( pos ); } </script> <!-----footer Panel-----> <?php echo $footer ;?> <!-----End of footer Panel-----> </body> </html> yes looking into this I am not sure if it can be done I was thinking could we display or re-write to show www.myurl.com.au/hotel_name/test-hotel but still pass the whole url with the deep link I am not to sure here is our webpage code with the API credentials taken out Quote Link to comment Share on other sites More sharing options...
oracle765 Posted January 3, 2015 Author Share Posted January 3, 2015 http://www.compareandchoose.com.au/hotel_details.php?hotel_id=278482¤cy_code=AUD&q='%3A%2F%2Fwww.travelnow.com%2Ftemplates%2F451536%2Fhotels%2F278482%2Foverview%3Flang%3Den%26amp%3Bcurrency%3DAUD%26amp%3BstandardCheckin%3D01%2F14%2F2015%26amp%3BstandardCheckout%3D01%2F15%2F2015%26amp%3BroomsCount%3D1%26amp%3Brooms%5B0%5D.adultsCount%3D2'&price=209&totlday=1 then anything after hotel ID so it would show just http://www.compareandchoose.com.au/hotel_details.php?hotel_id=278482 hi all been trying that apache tool but with no luck I only want it so show Quote Link to comment Share on other sites More sharing options...
requinix Posted January 3, 2015 Share Posted January 3, 2015 You can't magically recreate the currency_code, q, price, and totlday from just "/hotel_details.php?hotel_id=278482". This is one of those times where you don't use URL rewriting. Is it possible to generate/query for q programmatically so you don't have to put it in the URL? Quote Link to comment Share on other sites More sharing options...
CroNiX Posted January 3, 2015 Share Posted January 3, 2015 You could try shortening all of those variables, but you'd have to recode where they are used in your app too...but a simple find/replace could help with that. They don't need to be "human readable" in the URL. Your app is the only thing than needs to understand them. hid = hotel_id cc = currency_code etc Quote Link to comment Share on other sites More sharing options...
oracle765 Posted January 14, 2015 Author Share Posted January 14, 2015 hi requinix sorry for the late reply I have been trying everything but still cannot figure it out, I am not sure where to start about generating/query programmatically for q without having to put it in URL Quote Link to comment Share on other sites More sharing options...
requinix Posted January 14, 2015 Share Posted January 14, 2015 You had to get that q value from somewhere, right? Database? Used some logic to piece together a URL? Or is it coming from an external source you don't control? Quote Link to comment Share on other sites More sharing options...
oracle765 Posted January 25, 2015 Author Share Posted January 25, 2015 hi Requinix I am so lost with this still, I honestly have no idea where this q is coming from be it for the deeplink to pass through with the booking or some other form of logic I could send the page code if you like or I could send you ftp credentials to our test bed which is a replica but to be honest it has me beat Regards Alan Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted January 25, 2015 Share Posted January 25, 2015 in the posted code (reply #6), the only place the q= parameter is used is in the 'book now' link. it's not used in the curl request, which is just getting generic hotel information based on the hotel_id. the posted code is require'ing two other files. i'm going to guess that the 'files/hotel_list_page_form.php' code could contain the form/links/filters that picks/submits the url query string values you are seeing or that there's some other page on your site, before the one where the posted code is at, that's responsible for generating the url query string values. are these links actually a problem or are you just responding to what some tool is reporting? a problem with changing your code from passing this information through the url, to passing/recreating the information behind the scenes, is that someone cannot book-mark a link on your site and return later to the same place or share that book-marked location on your site with someone else. though, that brings up a question, a tool like you are using should not be submitting forms. this seems to indicate that somewhere on your site, you have a link that already has this information in it, that the tool simply found by looking at the html source. do you have links that show 'example' rooms w/options that the one you are showing us in the thread is case of or do you have simple links that when followed cause code on your site to retrieve 'example' rooms that then have the url query strings you are showing us? Quote Link to comment Share on other sites More sharing options...
oracle765 Posted January 26, 2015 Author Share Posted January 26, 2015 hi mac_gyver I am still so lost, because I didn't write this, I have looked at what you mentioned in example rooms with the query string and I still cannot figure it out. I have attached all the files associated with out hotel section and included the you hotel_list_page_form.php mentioned to see if you could spot if it could be shortened in any way as I now have over 3000 long url errors in MOZ tools Thanks again guys for you assistance in ironing this out expediafunction.php hotel_details.php hotel_form_check.php hotel_list.php hotel_list_page_form.php hotel_page_form.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.