Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2019-06-05 23:21:29

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Transparent Redirect homepage via htaccess (resolved)

Hi,

All is in the question;

I would redirect ( with a transparent redirection) my home page (Index Page) to an album with htaccess

I find this:

RewriteRule ^index.php$ /galleries/stock/index.php [L] 

It redirect my home page to the right page without modify the browser adress (Who stay https://phototheque.nicolaslogerot.com and not https://phototheque.nicolaslogerot.com/ … es/stock/) as I want but this redirect all the other page to an 404 error.

If I try with ^$ who is normally the root but it don't works:

RewriteRule ^$ /galleries/stock/index.php [L] 

Is anyone has an idea please?

Thanks
Nico

Last edited by Nico3939 (2019-06-05 23:43:22)

Offline

#2 2019-06-05 23:36:26

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Transparent Redirect homepage via htaccess (resolved)

I found a solution that seems to work.

By adding a test so that only the call to the root goes into proxy.
Code:

RewriteCond %{HTTP_HOST} ^phototheque.nicolaslogerot.com$ [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ /galleries/stock/ [L]

Offline

#3 2020-01-02 05:54:35

chumby
Member
Registered: 2014-10-23
Posts: 188

Re: Transparent Redirect homepage via htaccess (resolved)

Hi all,

Has anyone managed to get an album appearing on their homepage as per the instructions from Nico above?
My .htaccess file looks as below, but the redirection is not working:

<IfModule mod_headers.c>
    <FilesMatch "\.(eot|font.css|otf|ttc|ttf|woff)$">
        Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>

<IfModule mod_rewrite.c>
	RewriteEngine On

	#RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
	#RewriteRule ^(.*)$ - [E=BASE:%1]
	##RewriteRule ^(.*)$ - [E=BASE:]
	
	RewriteBase /
	RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
	RewriteRule ^.*$ - [E=BASE:%2]

	RewriteRule ^(.*)$ - [E=QS:mod_rewrite=on]

	RewriteRule ^([^\/.]*)-single.php$ %{ENV:BASE}single.php?%{ENV:QS}&id=$1 [QSA,L]

	RewriteRule ^([^\/.]*).css$ %{ENV:BASE}index.php?%{ENV:QS}&extension=css&name=$1 [QSA,L]
	RewriteRule ^([^\/.]*).js$ %{ENV:BASE}index.php?%{ENV:QS}&extension=js&name=$1 [QSA,L]
	RewriteRule ^([^\/.]*).gif$ %{ENV:BASE}index.php?%{ENV:QS}&extension=gif&name=$1 [QSA,L]
	RewriteRule ^([^\/.]*).png$ %{ENV:BASE}index.php?%{ENV:QS}&extension=png&name=$1 [QSA,L]
	RewriteRule ^([^\/.]*).jpg$ %{ENV:BASE}index.php?%{ENV:QS}&extension=jpg&name=$1 [QSA,L]

	#RewriteCond %{QUERY_STRING} !mod_rewrite=on
	#RewriteRule ^index.php$ %{ENV:BASE}index.php?%{ENV:QS} [QSA,L]

	RewriteCond %{QUERY_STRING} !mod_rewrite=on
	RewriteRule ^mobile.php$ %{ENV:BASE}mobile.php?%{ENV:QS} [QSA,L]

	RewriteCond %{QUERY_STRING} !mod_rewrite=on
	RewriteRule ^(.*)download.php %{ENV:BASE}download.php?%{ENV:QS} [QSA,L]

	#RewriteRule ^/?$ index.php [QSA,L]

	RewriteRule ^$ %{ENV:BASE}index.php?%{ENV:QS} [QSA,L]

	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d

	RewriteRule ^(.*)$ %{ENV:BASE}index.php?%{ENV:QS}&page=$1 [QSA,L]
    
        RewriteCond %{HTTP_HOST} ^tasmanianphotos.com$ [NC]
	RewriteCond %{REQUEST_URI} ^/$
	RewriteRule ^(.*)$ /galleries/tasmania/ [L]

</IfModule>

Offline

#4 2020-01-02 08:02:18

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Transparent Redirect homepage via htaccess (resolved)

Is there a reason to do this via .htaccess rather than just embedding the album on the home page?


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#5 2020-01-02 08:07:56

chumby
Member
Registered: 2014-10-23
Posts: 188

Re: Transparent Redirect homepage via htaccess (resolved)

Hi Rod,

Not sure which is best - but was just following Nico's lead here.

Funny the code above wasn't working/redirecting with Chrome but is with IE.

I managed to find the code below that seems to work on both Chrome and IE so I will use that.

Thank you for you help again.

    RewriteCond %{HTTP_HOST} !^(www\.tasmanianphotos\.com)?$ 
    RewriteRule ^(.*)$ http://www.tasmanianphotos.com/$1 [R=301]
    RewriteCond %{REQUEST_URI} !/galleries/tasmania/
    RewriteRule ^(.*)$ /galleries/tasmania/$1 [L]

Offline

#6 2020-01-02 08:20:28

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Transparent Redirect homepage via htaccess (resolved)

hmmm.... but you can integrate a gallery on the front page and get the same effect, can't you?


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#7 2020-01-02 08:42:07

chumby
Member
Registered: 2014-10-23
Posts: 188

Re: Transparent Redirect homepage via htaccess (resolved)

Hi Daniel,

Will need to look closer to answer your question - I'm still very new at this.

I am trying to get a "stock images" page together similar to Nico's at:

https://phototheque.nicolaslogerot.com

Would there be a reason not do the redirect now it's working

Cheers,
Chumby

Offline

#8 2020-01-02 09:37:36

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Transparent Redirect homepage via htaccess (resolved)

I have a slow internet connection. Between the original page loaded and I added a reply, you already posted an update....

I try not to touch .htaccess if not necessary and stick with Backlight 2 native solutions, if possible.


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#9 2020-01-03 08:08:44

chumby
Member
Registered: 2014-10-23
Posts: 188

Re: Transparent Redirect homepage via htaccess (resolved)

Ok, thanks - that makes sense Daniel.

I will clean up the htaccess file then and then try to embed the album on the front page.

Do you know off hand the method for doing that?  Is there a setting in "Edit-Top-Level_Gallery" or somewhere else?

Cheers
Chumby

Offline

#10 2020-01-03 08:18:12

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Transparent Redirect homepage via htaccess (resolved)

Edit your Home Page in Backlight > Designer > Pages. Click Design next to your Home page. Click on Insert Album. Then just choose the album.
http://backlight.theturninggate.net/doc … r-pages-b2


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#11 2020-01-03 08:58:12

chumby
Member
Registered: 2014-10-23
Posts: 188

Re: Transparent Redirect homepage via htaccess (resolved)

Cheers Rod... will check it out.

Offline

#12 2020-01-10 00:20:20

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Transparent Redirect homepage via htaccess (resolved)

hummm ... I admit I don't remember how I did it anymore, I look and come back here

Offline

#13 2020-01-10 00:26:27

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Transparent Redirect homepage via htaccess (resolved)

I don't really remember how I did it (almost 1 year now).

Here is my htacess:


<IfModule mod_headers.c>
    <FilesMatch "\.(eot|font.css|otf|ttc|ttf|woff)$">
        Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>

<IfModule mod_rewrite.c>
	RewriteEngine On

	RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
	RewriteRule ^(.*)$ - [E=BASE:%1]
#	RewriteRule ^(.*)$ - [E=BASE:]
#	RewriteBase /backlight/
#	RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
#	RewriteRule ^.*$ - [E=BASE:%2]

	RewriteRule ^(.*)$ - [E=QS:mod_rewrite=on]

	RewriteRule ^/?search\/?$ %{ENV:BASE}index.php?%{ENV:QS}&m=publisher&c=gallery&a=search [QSA,L]

	RewriteRule ^/?([a-zA-Z_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)\/?$ %{ENV:BASE}index.php?%{ENV:QS}&m=$1&c=$2&a=$3&p1=$4&p2=$5&p3=$6&htline=1 [QSA,L]
	RewriteRule ^/?([a-zA-Z_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)\/?$ %{ENV:BASE}index.php?%{ENV:QS}&m=$1&c=$2&a=$3&p1=$4&p2=$5&htline=2 [QSA,L]
	RewriteRule ^/?([a-zA-Z_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)\/?$ %{ENV:BASE}index.php?%{ENV:QS}&m=$1&c=$2&a=$3&p1=$4&htline=3 [QSA,L]
	RewriteRule ^/?([a-zA-Z_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)\/?$ %{ENV:BASE}index.php?%{ENV:QS}&m=$1&c=$2&a=$3&htline=4 [QSA,L]
	RewriteRule ^/?([a-zA-Z_\-]+)/([a-zA-Z0-9_\-]+)\/?$ %{ENV:BASE}index.php?%{ENV:QS}&m=$1&c=$2&htline=5 [QSA,L]
	RewriteRule ^/?([a-zA-Z_\-]+)\/?$ %{ENV:BASE}index.php?%{ENV:QS}&m=$1&htline=6 [QSA,L]
	# Enable passing of mod_rewrite for /backlight/ site root
	RewriteRule ^$ %{ENV:BASE}index.php?%{ENV:QS}&htline=7 [QSA,L]

	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule ^.*$ %{ENV:BASE}index.php?%{ENV:QS}&htline=8 [QSA,L]
</IfModule>

Note: # lines are for my maintenance page

Offline

#14 2020-01-10 00:29:48

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Transparent Redirect homepage via htaccess (resolved)

For information my home page is an album published from lightroom in which I wrote the html directly in "Page Content" "Main Copy" in:

Backlight> Publisher> Galleries> Albums

Last edited by Nico3939 (2020-01-10 00:33:47)

Offline

Board footer

Powered by FluxBB