Search…

X3 Photo Gallery Support Forums

Search…
 
eskimo121
Experienced
Topic Author
Posts: 104
Joined: 01 Jun 2012, 21:22

Changing the index file

10 Aug 2013, 19:02

Hello,
I would like to change the default index page ( index.php ) to something different while keeping the rest of the site unchanged. What i mean is I want to keep the front page/index.html in plain HTML not linked to the gallery while the rest of it functions as it was.
The reason is I want to change the front page to a non-flash one, but i want to preserve the internal links that google has already indexed so people visiting through them wont get a 404 error.
For example: If my site had 3 files index.html
about.html
project.html
I want to change the index to a different page while keeping the about and project page intact so people visiting them directly can still see them. And the new users who visit the homepage can see the new homepage (unrelated to the old site).
Simply creating an index.html file in the directory doesnt work as its changing the whole site. Visiting an internal link doesnt show the gallery, instead shows the content of the index.html file

Changing the index.php causes the same problem as above. Seems like the line :
Code
include_once('imagevue.php');
needs to be included for any gallery page to display.

Will including this line include_once('imagevue.php'); in all other php files work ? Or specifically what pages get called when i visit a link such as http://yyyyyy.com/#/places/ directly so i can include that line in them?

Do i need to edit the .htaccess file or something to make it work? or perhaps some .phtml file needs to be edited?
is it possible at all?

To be clear: What im trying to do is this -- Visiting http://yyyyy.com should show me a normal html website unrelated and not linked to imagevue but Visiting http://yyyyy.com/#/places/ directly should show me the gallery pictures as it is.
I just want to change the homepage to nonflash html with a menu redirecting users elsewhere, while keeping the internal pages/folders intact so people visiting it directly through google indexed pages can still find those pages and browse them.
Thanks.


Bored? Browse through some cool images: Amazing Pictures
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13999
Joined: 30 Sep 2006, 03:37

Re: Changing the index file

11 Aug 2013, 11:03

Unfortunately its not that simple ...

http://yyyyyy.com/
http://yyyyyy.com/#/places/ <-- Same page as above
http://yyyyyy.com/#/anything/here/after/hashtag/ <-- Same page as above

Unfortunately, those 3 pages above are basically the same page. The #hashtag simply instructs the website through javascript what content to display. If you are going to change the page that displays at http://yyyyyy.com/, then it would change the other links also unfortunately.

Why not just rename your index.php to gallery.php? All your links would change into http://yyyyyy.com/gallery.php#/places/, but there is nothing wrong with that, and Google will always re-index your links anyway. Actually, there might be some way to use the .htaccess file to tell the server to use index.php if there is #hashtags in the URL, but I simply don't know how to go about that. I would recommend choosing the easier solution though simply renaming the file.
 
User avatar
Artur
Imagevue PowerPack
Posts: 510
Joined: 20 May 2011, 03:17

Re: Changing the index file

11 Aug 2013, 12:00

Unfortunately, #hashtag can't be manipulated within .htaccess file as it's not even sent to the server (your server don't know really whether the '#' exists in te url or not).

The only way you can set this up is to manipulate the hashtag by javascript and then make an AJAX -> PHP request to load specific content. Alternatively, using javascript check the '#' existence, set the cookie 'hashTag=true' or 'hashTag=false', read the cookie later by PHP and load content based on the result. But keep in mind that some ppl disable cookies. In this case your index.php file may looks like this:
Code
<?php
session_start();
?>
<!DOCTYPE html>
<script type="text/javascript">
    
var m = location.href;
var cookie = readCookie("hashTag");

function createCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function eraseCookie(name) {
    createCookie(name,"",-1);
}

if (m.indexOf("#") > -1) {
	if(cookie != 'true'){
		createCookie("hashTag", 'true', 1);
		location.reload();
	}
}else{
	if(cookie != 'false'){
		createCookie("hashTag", 'false', 1);
		location.reload();
	}
}
</script>



<?php 

if (version_compare('5.1.3', phpversion()) > 0) {
	?>
		<html>
			<head>
				<title>Sorry, PHP 5.1.3 is required</title>
				<link rel="stylesheet" type="text/css" href="iv-admin/assets/css/imagevue.admin.css" media="all">
			</head>
			<body>
				<div class="page">
					<div class="pageContent" style="text-align: center">
						<div class="note warning" style="margin: 100px; display: inline-block">
							Sorry, Imagevue requires <b>PHP 5.1.3</b> to run. You have <strong>PHP <?php echo phpversion() ?></strong> installed.
						</div>
					</div>
				</div>
			</body>
		</html>
	<?php
	die();
}

if (isset($_COOKIE['hashTag']) && $_COOKIE['hashTag'] == "true"){
	include_once('imagevue.php');
}else{
	echo 'This is my HTML start page!';
}
This basicaly works, but I can't quarantee you that don't get any problems with that... I would stick to Karl suggestion anyway.
 
eskimo121
Experienced
Topic Author
Posts: 104
Joined: 01 Jun 2012, 21:22

Re: Changing the index file

12 Aug 2013, 06:23

Thanks a lot guys. Thanks Karl for the idea. I'll use renaming as the final option after testing some stuff.
And wow! thanks Artur for taking the time to come up with the index file. I read about the ajax method but wasn't sure how to go about it. Your code will be very helpful. I'll try it right away. Could you also tell me what i need to replace/write in that index file if the url had a question mark (?) instead of # hash?
example: http://yyyyy.com/?/CatPics/‎

Right now i'm experimenting with a combination of Arturs script and some .htaccess redirection based on referrer (people coming from google) and see how it goes.
Code
<?php
$referrer = $_SERVER['HTTP_REFERER'];
if (preg_match("google.com/",$referrer)) {
      header('Location: http://yyyyy.com/page-site1.html');
};
?>

Probably use some index.php and index2.php and experiment.
Thanks.


Bored? Browse through some cool images: Amazing Pictures
 
User avatar
Artur
Imagevue PowerPack
Posts: 510
Joined: 20 May 2011, 03:17

Re: Changing the index file

12 Aug 2013, 11:05

If you are about a question mark only, not bothering about the hashtag, then just call a short function straight in php, without even using javascript.
Code
if(strstr($_SERVER['REQUEST_URI'], '?')){
	include_once('imagevue.php');
} else {
	echo 'We haven\'t found a question mark in the url. This is my bla bla page...';
}

But... Checking the occurence of "hash" and "question mark" together in the url is a bit more complicated... You gonna check relationship between them both.
Because you may have links like: yyyyyy.com/?language=english#/folder/image.jpg :wink:

Honestly, if you're about SEO only, then I wouldn't care about making some SEO tweeks to the imagevue gallery. Since mobile version was released, I've noticed a big improvement in the SEO, so you don't need to be worry about google index (however, flash is also indexed by some crawlers).
When you start messing up with synthetic SEO tweeks, you may forget about the user - which is your SEO actually.
Make your content interesting, let people know about it - share on facebook, google+, pinerest. Share on forums, blogs, etc... If the ppl came to your site often, then I can assure you that crawlers will follow them even if your site is a simple flash page :wink:
 
eskimo121
Experienced
Topic Author
Posts: 104
Joined: 01 Jun 2012, 21:22

Re: Changing the index file

13 Aug 2013, 17:26

Sorry i couldn't reply earlier. Still messing with it but You are right about SEO Artur. I was just about getting sick of the modifications and was going to move Imagevue to a sub-directory with a permanent redirect from yyyy.com ---> yyyy.com/oldgallery and let google re-index the new links (after which i would remove the redirect) .....but all of a sudden google starts sending in more visitors last couple of days. So i was hesitating whether I should change it at this time or wait a while. Then again, this influx of visitors maybe temporary.

Oh yes, ever since they released the mobile version of imagevue the search engines have had chance to index considerably more.

But once again, thank you for your assistance Artur (and also the ever-present Karl) Appreciate it.

Staring at the screen for long hours is messing with my eyes. Gotta stay away a bit more.
have a nice day.
Btw, really crisp and creative photographs on your site! Nice technique and post processing. :mrgreen:
Thanks.


Bored? Browse through some cool images: Amazing Pictures