Announcement

#1 2022-02-19 15:15:15

rajdude
Member
2021-05-18
90

How to change Piwigo's URL to up one level directory?

Hello everyone,
I am very new to Piwigo and managed to install it using my web host's Softalicious tool. I told it to install it under the directory "public_html/rajdude.com/photography", so it did. I did not want it to be installed under public_html. I host multiple websites under public_html so I like to have each website sitting under its own directory.

Problem:
The URL for Piwigo is now https://rajdude.com/rajdude.com/photography
I want it to be https://rajdude.com/photography

How can I change it?



I have searched here and Googled it but not found a straightforward way to do it.
Do I edit .htaccess file? (right now there is no such file under Piwigo's root)
I could do a redirect in it. But after that, doesn't Piwigo needs to be re-configured?
I do have access to cPanel.


My environment details:


    Piwigo 12.2.0 Check for upgrade
    Operating system: Linux
    PHP: 7.3.33 (Show info) [2022-02-19 09:10:43]
    MySQL: 5.5.5-10.3.23-MariaDB-cll-lve [2022-02-19 09:10:43]
    Graphics Library: ImageMagick 7.1.0-20
    Cache size N/A   never calculated Refresh


Thank you for your help in advance!
-Raj

Offline

 

#2 2022-02-20 08:37:19

beepro
Member
2021-09-05
59

Re: How to change Piwigo's URL to up one level directory?

the simplest solution is to reinstall again, this time under

public_html/photography

you will still have your stuff under a separate directory, of course, this being "photography"

Offline

 

#3 2022-02-21 16:19:39

rajdude
Member
2021-05-18
90

Re: How to change Piwigo's URL to up one level directory?

right, but that is not what I want.
Why?
Because I have multiple websites under public_html, each in its own folder.
Like this:

public_html/rajdude.com/
public_html/somethingelse.com/
public_html/anotherwebsite.com/

Under each of them, I have stuff installed like Wordpress, PiWigo, gallery etc. e.g.

public_html/rajdude.com/photography
public_html/somethingelse.com/photography


I want to keep multiple installations of same software separate.

Offline

 

#4 2022-02-21 18:09:38

Katryne
Member
2016-12-03
369

Re: How to change Piwigo's URL to up one level directory?

Personnally, I use sub-domains for this. Are you the owner of your domain ? Can you create sub-domains ? If so, you do not need to move the folder where your Piwigo is, just direct the subdomain to the correct folder.

Suppose my domain is katrynou.fr, my different sites will be addressed by : forum.katrynou.fr, photography.katrynou.fr, news .katrynou.fr...

Last edited by Katryne (2022-02-21 20:04:02)


http://photos.katrynou.fr/ v.14.1.0 https://album.chauvigne.info/ v.13.8.0
Système d'exploitation: Linux - Hébergeur 1&1-Ionos PHP: 8.0.28 - MySQL: 5.7.38
Bibliothèque graphique: External ImageMagick 6.9.10-23

Offline

 

#5 2022-02-22 15:01:09

rajdude
Member
2021-05-18
90

Re: How to change Piwigo's URL to up one level directory?

yeah, that would be another way of doing it.

Problem: even if I create a subdomain, Piwigo still shows the actual folder structure in the file system in the URL

BTW, I would like to have a sub-directory for Piwigo instead of a sub domain. I guess it boils down to personal preference :-)

Offline

 

#6 2022-02-22 15:46:51

rajdude
Member
2021-05-18
90

Re: How to change Piwigo's URL to up one level directory?

ok so today, I am doing some further research into this issue and here are my findings:

Other people have posted on how this is done. For example this one is pretty clear:

https://webmasters.stackexchange.com/qu … g-htaccess

quote:

You do this by physically changing the URLs in your application, not in .htaccess. Once the URLs have been changed in your application, the request is then for www.example.com/page1, the visible URL that is shown to your users (not page.php). You then use mod_rewrite in .htaccess to internally rewrite the visible URL back to the real/hidden filesystem path: /subdir1/subdir2/page1.php. (But I suspect you already know this, since your code is doing the right kind of thing.)

unquote.

ok so I started looking for a config file for Piwigo and I found this:
https://piwigo.org/doc/doku.php?id=user … onf_locale

Since I have local filesystem access on my webhost, I went looking and I see this:
Under public_html/rajdude.com/photography/local/config/, two files exist:
database.inc.php
index.php

However, the file mentioned in the Piwigo article  local/config/config.inc.php. does not exist.
Guessing it needs to be created first.

Anyway, if I look at the  include/config_default.inc.php file, I do not see something which will let me change the URL of the application (Piwigo).

I guess right now it is set to / and I need to change it to /../ meaning down one level?

Can anyone expert in configuring Piwogo's config files please help me here?
Highly appreciated!

Offline

 

#7 2022-02-22 20:15:33

erAck
Only trying to help
2015-09-06
2026

Re: How to change Piwigo's URL to up one level directory?

I think you're on a completely wrong approach.

If your Piwigo's directory hierachy is public_html/rajdude.com/photography/... then you create a subdomain, for example photo.rajdude.com, and point it to public_html/rajdude.com/photography instead of public_html/rajdude.com, nothing to fiddle around with .htaccess or Piwigo's local config.

Apart from that, if you want to create a local config for Piwigo's internal working you can use [extension by Piwigo Team] LocalFiles Editor (activate in the extensions manager). You can also directly create and edit the file manually, provided you know what you're doing and don't omit the <?php and ?> markers at begin and end of file.


Running Piwigo at https://erack.net/gallery/

Offline

 

#8 2022-02-23 00:18:45

rajdude
Member
2021-05-18
90

Re: How to change Piwigo's URL to up one level directory?

Well, yes, it is quite possible to take that subdomain approach also (I think I posted that above)...but it is a personal preference.

But since two people have suggested it here. I went ahead and made a subdomain and pointed it to the correct path on the web server - public_html/rajdude.com/photography/

Piwigo still does not work on that URL! It throws a 404 error.
--------Wait, I fixed it! Had to remove the .htaccess file in there-----
Check it out
https://photography.rajdude.com/
--------Wait, I fixed it! Had to remove the .htaccess file in there-----


BTW, this still works fine:
https://rajdude.com/rajdude.com/photography/

I have contacted the hosting service. They looked at it and said it is not their server problem, they say I need to contact a web application expert to fix this issue :-( That is not possible for me, I mean, this is just my personal website, I am not running a business here.


PS: You recommend using a subdomain, but you are using a sub-directory for your own website. I wonder if the sub-domain option did not work for you?

Last edited by rajdude (2022-02-23 00:25:23)

Offline

 

#9 2022-02-23 03:57:29

beepro
Member
2021-09-05
59

Re: How to change Piwigo's URL to up one level directory?

I do not understand, I have the same thing, about 6 different domains on the same server, 3 have wordpress and 3 have piwigo (but none has both)

I add subdomains and then direct it to the right directory. I try to keep the URL short because it is easier for others to remember.

Offline

 

#10 2022-02-23 04:07:35

erAck
Only trying to help
2015-09-06
2026

Re: How to change Piwigo's URL to up one level directory?

If with this directory structure
public_html/rajdude.com/photography/
the URL https://rajdude.com/rajdude.com/photography/ points to that very same location then either you have the domain rajdude.com pointing to public_html/ as can be seen also with https://rajdude.com/rajdude.com/ that just works similar (and delivers some index file's content "welcome to rajdude.com"), or you have some weird rewrite in .htaccess that you forgot about. There's no issue that should be fixed on the application level, but your hosting provider is right in that they said it is not their server problem, it is just how you set up things. And likely it's the same for your other domains and they might even be able to cross-access the other domains' directories, which would be bad. You probably have some .htaccess somewhere that redirects https://rajdude.com/ to https://rajdude.com/blog/ while rewriting paths, i.e. https://rajdude.com/rajdude.com/blog/ does not exist or is not accessible.

If you want https://rajdude.com/photography/ then fix your rajdude.com domain setup to point to the correct public_html/rajdude.com/ directory, but be aware that you'll have to change something that so far does the current redirect/rewrite to the blog/ subdirectory.

You could tweak public_html/.htaccess to redirect all https://rajdude.com/rajdude.com/photography/ to https://photography.rajdude.com/ or https://rajdude.com/photography/ or rewrite accordingly, without changing the domain setup, similar to what you did for https://rajdude.com/blog/, but that's a mess.

I might be wrong in my conclusion about your domain setup, but it's the most obvious.


Running Piwigo at https://erack.net/gallery/

Offline

 

#11 2022-03-01 18:25:03

rajdude
Member
2021-05-18
90

Re: How to change Piwigo's URL to up one level directory?

Thank you very much for your detailed analysis and suggestions :-)
I got a little bit time to work on this.

My folder structure looks like a mess :-( I changed web hosts and the new host said that the main domain's document root cannot be changed from /home/username/public_html to /home/username/public_html/rajdude.com. Due to some technical limitation, it has to stay like that.

Then I made a mistake of putting all other domains under /home/username/public_html/
e.g.
/home/username/public_html/mydomain1.com
/home/username/public_html/mydomain2.com

Yesterday I talked to them and found out that I am allowed to put the document root of other domains under /home/username/

So I made the decision to fix this problem, slowly. Starting with Piwigo. The correct folder structure (for my particular situation) should be:
/home/username/mydomain1.com
/home/username/mydomain2.com

Of course, the main domain, rajdude.com needs to stay as
/home/username/public_html/


So I uninstalled Piwigo and re-installed it under /home/username/public_html/photos and now the URL I want works fine.

https://rajdude.com/photos

Thank you all for looking into this and enduring my crazy ideas ;-)


PS: yes, I do have a rewrite in .htaccess which directs rajdude.com to rajdude.com/blog

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact