Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
ewmjr
Topic Author
Posts: 3
Joined: 23 Apr 2020, 13:24

Make X3 the default for domain

19 May 2020, 15:21

Greetings, 
Kind of a stupid question... I've been running Koken for a few years now and I've just gotten X3 to where it's ready for prime-time.

So how do i get X3 to load instead of Koken when I enter my domains URL?

Do I just replace the Koken htaccess file with the X3 version or is there something else I need to do? 

Thanks, Ed
 
User avatar
mjau-mjau
X3 Wizard
Posts: 12093
Joined: 30 Sep 2006, 03:37

Re: Make X3 the default for domain

19 May 2020, 21:49

I'm assuming you have uploaded X3 into a sub-directory on your website, for example yourwebsite.com/x3/? And I assume you want X3 to load from the ROOT url of your website yourwebsite.com? The only "correct" way to achieve this, is to physically MOVE the contents of the /x3/ directory one level up, so that it's located in the root of your website. To provide accurate instructions, I would need to know these details ... Also, do you want/need to make a backup of your existing Koken website first?

You can "move" data on your server by FTP. However, FTP will be slow for this, because it basically needs to download/upload to/from your desktop while moving files, even if files are only moved on the server. BEST option, is if your HOSTING company has a "file manager" available from the hosting account control panel. This is much faster, because everything happens on the server.

There are a couple of other ways, for example using "url rewrite" to map requests to the directory where X3 exists. Or you could also ask your host to change the server config to point to the directory where X3 exists. However, I would recommend against this, as it can often lead to a mess, now and in the future. Ultimately, you need to "move" X3 into the location on server where you want it to show ... As I understand, that is by moving it into the directory where you now have Koken ...
 
User avatar
ewmjr
Topic Author
Posts: 3
Joined: 23 Apr 2020, 13:24

Re: Make X3 the default for domain

19 May 2020, 23:02

Thanks for the detailed reply. Moving the directory should work.
The reason I asked the question is that all the koken files are also in a subdirectory. In fact the koken htaccess file is the only file at the root level. Is there any way X3 can work the same way?
Thanks again, Ed
 
User avatar
mjau-mjau
X3 Wizard
Posts: 12093
Joined: 30 Sep 2006, 03:37

Re: Make X3 the default for domain

20 May 2020, 03:15

ewmjr wrote:The reason I asked the question is that all the koken files are also in a subdirectory.  In fact the koken htaccess file is the only file at the root level. Is there any way X3 can work the same way?
May I see the content of the .htaccess file? It's certainly possible with some rewrite rules. However, this could also be set in your server config (unrelated to the .htaccess file), so it needs to be checked. Also, when you access your current koken, does the URL actually display yourwebsite.com? Or does it redirect to some sub-directory yourwebsite.com/koken? (both can be achieved).

Yes it can be done, but it's not best practice. Rewrite or redirect will create a tiny delay on all requests. Besides, if you plan your folder structure properly, there is no reason you should not put your actual website content in the root. After all, if you "rewrite" your website root to the X3 dir, it's not possible to access any other files or folders in your root, which defeats the purpose of them being stored there in the first place. If you have private/unused files and folders that you want to keep (eg backup), they could for example be located in the PARENT directory of your website root. This is probably more secure also.
 
User avatar
ewmjr
Topic Author
Posts: 3
Joined: 23 Apr 2020, 13:24

Re: Make X3 the default for domain

20 May 2020, 09:45

Thanks again for the reply.
I’m just going to move the X3 files.
I’ve included the Koken-htaccess file for you to look at. 
 
Thanks, Ed 
## Uncomment the following block to force SSL when accessing /admin
# <IfModule mod_rewrite.c>
# RewriteEngine On
# RewriteCond %{REQUEST_URI} /admin/
# RewriteCond %{SERVER_PORT} 80
# RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# </IfModule>

####### DO NOT EDIT BELOW THIS LINE ########

#MARK#######################################
######## KOKEN .htaccess rules ########
############################################

## Make sure settings.css.lens is rendered as CSS
AddType text/css .lens

## SVG MIME type as some servers don't have it
AddType image/svg+xml .svg

## UTF-8 encoding for everything
AddDefaultCharset utf-8

DirectoryIndex index.php index.html

## Enable gzip.
## Highly recommended as it will increase speed for
## both the console and your published site.
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/json application/javascript application/x-javascript
</IfModule>
## END gzip

## Rewrite Rules (Pretty URLs)
## These rules remove index.php/ from your published site links
## and also speed up the serving of cached images.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Pass images requests back to PHP if they do not exist
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} /koken/storage/cache/images(/(([0-9]{3}/[0-9]{3})|custom)/.*)$
RewriteRule . /koken/i.php?path=%1 [L]

# Pass albums requests back to PHP if they do not exist
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} /koken/storage/cache/albums(/([0-9]{3}/[0-9]{3})/.*)$
RewriteRule . a.php?path=%1 [L]

# Catch root requests (pjax)
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{REQUEST_URI} ^/?$
RewriteCond %{QUERY_STRING} _pjax=
RewriteCond %{DOCUMENT_ROOT}/koken/storage/cache/site/index/cache.phtml -f
RewriteRule .* /koken/storage/cache/site/index/cache.phtml [L]

# Catch root requests
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{REQUEST_URI} ^/?$
RewriteCond %{QUERY_STRING} !_pjax=
RewriteCond %{DOCUMENT_ROOT}/koken/storage/cache/site/index/cache.html -f
RewriteRule .* /koken/storage/cache/site/index/cache.html [L]

# Catch site requests (pjax)
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{QUERY_STRING} _pjax=
RewriteCond %{DOCUMENT_ROOT}/koken/storage/cache/site%{REQUEST_URI}cache.phtml -f
RewriteRule . /koken/storage/cache/site%{REQUEST_URI}cache.phtml [L]

# Catch site requests
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{QUERY_STRING} !_pjax=
RewriteCond %{HTTP_COOKIE} !share_to_tumblr=
RewriteCond %{DOCUMENT_ROOT}/koken/storage/cache/site%{REQUEST_URI}cache.html -f
RewriteRule . /koken/storage/cache/site%{REQUEST_URI}cache.html [L]

# CSS / RSS caching
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/koken/storage/cache/site%{REQUEST_URI} -f
RewriteRule . /koken/storage/cache/site%{REQUEST_URI} [L]

# Rewrite any old URLs that still use index.php?/this/that syntax
RewriteCond %{QUERY_STRING} ^/(.*)
RewriteRule ^index.php %1? [R,L]

# Rewrite any old URLs that still use index.php/this/that syntax
RewriteRule ^index.php/(.*)$ $1 [R,L]

# Catch root requests
RewriteRule ^(index.php)?$ /koken/app/site/site.php?url=/&base_folder=/ [L,QSA]

# Do not enable path rewriting for files that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !favicon.ico

# For requests that are not actual files
# rewrite to index.php?/PATH
RewriteRule ^(.*)$ /koken/app/site/site.php?url=/$1&base_folder=/ [L,QSA]
</IfModule>

## This ruleset ensures core Koken JS and CSS are cached
## for 1 year. These files are always timestamped in new releases,
## so it is safe to cache them for long periods of time.
<IfModule mod_expires.c>
ExpiresActive On
# Set default to 0 so .php/API requests are not cached
ExpiresDefault A0

# Do not cache MP4s, as Chrome and others tend to fail on first playback
<FilesMatch "\.mp4$">
<IfModule mod_headers.c>
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</IfModule>
</FilesMatch>

# Console javascript and CSS is timestamped and can be aggressively cached
<FilesMatch "console_.*\.(js|css)$">
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
</FilesMatch>

# Cached images are timestamped and can be aggressively cached
<FilesMatch "\.\d{9,10}\.(jpg|jpeg|gif|png|JPG|JPEG|GIF|PNG)$">
ExpiresDefault "access plus 1 year"
</FilesMatch>
</IfModule>

## End Rewrite Rules

############################################
####### END KOKEN .htaccess rules  ########
############################################
 
User avatar
mjau-mjau
X3 Wizard
Posts: 12093
Joined: 30 Sep 2006, 03:37

Re: Make X3 the default for domain

20 May 2020, 21:11

:thumbsup: Probably related to the below. It can be achieved in X3 also, but then we need to modify the X3 .htaccess file slightly.
Code
# Catch root requests
RewriteRule ^(index.php)?$ /koken/app/site/site.php?url=/&base_folder=/ [L,QSA]