Page 1 of 1

installatie overgezet, alleen index te zien

Posted: Tue May 19, 2020 3:45 pm
by erpee
Ik heb een werkende installatie overgezet naar mijn eigen server.

htaccess uitgeschakeld
config aangepast
cache en templates_c zijn leeggemaakt. (ook nog een keer via admin>buffer legen)

Ik kan de admin gewoon gebruiken, bij de site zelf zie ik de landingspagina. Klik ik op een ander menuitem, dan krijg ik een 404

config:

Code: Select all

$config['dbms'] = 'mysqli';
$config['db_hostname'] = 'localhost';
$config['db_username'] = 'root';
$config['db_password'] = '*****';
$config['db_name'] = '*****';
$config['db_prefix'] = 'cms_';
$config['timezone'] = 'Europe/Amsterdam';
$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '.htm';
$config['use_hierarchy'] = '1';
$config['query_var'] = 'page';
$config['developer_mode'] = '1';
Waar mis ik iets waardoor de andere pagina's niet zichtbaar zijn?

Re: installatie overgezet, alleen index te zien

Posted: Tue May 19, 2020 3:49 pm
by velden
Ik vermoed dat de .htaccess file niet mee is gekopieerd

EDIT: htaccess uitgeschakeld? Weet niet wat je daarmee precies bedoelt, maar mod_rewrite is wel afhankelijk van die .htaccess file.
Dus dan zou je de config.php moeten aanpassen eventueel.

Re: installatie overgezet, alleen index te zien

Posted: Tue May 19, 2020 4:03 pm
by erpee
Ik had 'm hernoemd omdat 'ie ervoor zorgde dat ik niet in de juiste directory kwam. Er staat dus ws. iets mis in de htaccess.
Als ik de site aanroep: servernaam/avi-2020, dan word ik omgeleid naar de root van de server, niet de subdirectory.

Ergens gaat het dus fout.

Code: Select all

# This file is specific to Apache configurations.
# It attempts to optimize traffic and configuration for your CMS Made Simple™ website.
# Many options are disabled by default as some providers do not allow you to override some of these settings in the .htaccess file.

#
# Attempt to override some PHP settings.
# These settings may be helpful on some hosts if your default configuration does not meet CMSMS's minimum requirements,
# and your host has given your account appropriate permissions.
#
#php_value upload_max_filesize "10M"
#php_value session_save_path "tmp/cache"
#php_value session.cookie_httponly true
#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
#php_flag session.use_trans_sid Off

#
# Disallow directory indexes. This can be an important security enhancement.
#
#Options -Indexes

#
# Don't allow the browser to know the type of signature.
#
ServerSignature Off

#
# Allow the Apache server to follow symbolic links. This is usually not necessary.
#
#Options +FollowSymLinks

#
# The following is to enable pretty URLs, only applicable if url_rewriting is set to 'mod_rewrite' in the config.php
#
<IfModule rewrite_module>
	RewriteEngine on
	# If your CMSMS installation is in a subdirectory of your domain, you need to specify the relative path (from the root of the domain) here.
	# In example: RewriteBase /[subdirectory name]
	RewriteBase /avi-2020/
	
# +++++ ADD THIS - START +++++
  # Link to http(s)://website... then redirect to https://www.website...
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

  # Force URLs have https instead of http
  RewriteCond %{HTTPS} off
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# +++++ ADD THIS - END +++++
	
	# Rewrites URLs in the form of /parent/child/grandchild but only rewrites if the requested URL is not a file or directory.
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>

#
# The following are highly recommended security settings for files in your CMSMS install that should not be browsed directly.
#
RedirectMatch 403 ^/.*\.htaccess$
RedirectMatch 403 ^/.*\.log$
RedirectMatch 403 ^/.*\.ini$
RedirectMatch 403 ^/.*config\.php$
RedirectMatch 403 ^.*/doc/.*$
RedirectMatch 403 ^.*/lib/.*\.php$
RedirectMatch 403 ^.*/tmp/.*\.php$
RedirectMatch 403 ^.*/modules/.*\.php$
RedirectMatch 403 ^.*/uploads/.*\.php$
RedirectMatch 403 ^.*/assets/.*\.php$
RedirectMatch 403 ^.*/assets/.*\.tpl$

#
# The following are performance optimizations and security enhancements for content that is served by your CMSMS installation.
#
<IfModule mod_headers.c>
    # Disable Last-Modified for performance
    Header unset Last-Modified
	# Disable ETags
	Header unset ETag
	FileEtag None
	# For Security
	Header set X-Frame-Options "SAMEORIGIN"
</IfModule>

#
# The following setups compression for content, if compression is enabled on the server.
#
<IfModule deflate_module>
	AddOutputFilterByType DEFLATE text/html text/css text/plain text/html text/xml image/gif image/jpeg image/png image/ico text/javascript application/x-javascript application/javascript application/json application/pdf
</IfModule>

#
# The following allows the browser to cache images, scripts, stylesheets and videos. If the expires module is enabled on the server.
# Note, this applies to admin directory stuff too.
# however, for php files in the admin directory we explicitly st the header to not expire
#
<IfModule mod_expires.c>
	ExpiresActive On
	ExpiresDefault "access plus 1 month"
	# Set expires tags on various file types... so that the browser won't attempt to reload them.
	ExpiresByType image/jpg "access plus 1 year"
	ExpiresByType image/gif "access plus 1 year"
	ExpiresByType image/ico "access plus 1 year"
	ExpiresByType image/png "access plus 1 year"
	ExpiresByType video/x-flv "access plus 1 year"
	ExpiresByType application/pdf "access plus 1 year"
	ExpiresByType application/x-shockwave-flash "access plus 1 year"
	ExpiresByType application/javascript "access plus 1 month"
	ExpiresByType application/x-javascript "access plus 1 month"
	ExpiresByType text/javascript "access plus 1 month"
	ExpiresByType text/css "access plus 1 month"
	<IfModule mod_headers.c>
		# Setting cache control to public allows proxy servers to cache the items too.
		Header set Cache-Control "public"
	</IfModule>
</IfModule>

Re: installatie overgezet, alleen index te zien

Posted: Wed May 27, 2020 7:50 pm
by janvl
is dit al opgelost?

mvg,
Jan

Re: installatie overgezet, alleen index te zien

Posted: Thu May 28, 2020 6:34 am
by erpee
Ja en nee.

Ik ben aan de knutsel gegaan. Het dit stuk in de htaccess geremarkt en dat werkt.

Code: Select all

# +++++ ADD THIS - START +++++
  # Link to http(s)://website... then redirect to https://www.website...
  #RewriteCond %{HTTP_HOST} !^www\. [NC]
  #RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

  # Force URLs have https instead of http
  #RewriteCond %{HTTPS} off
  #RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# +++++ ADD THIS - END +++++
Maar om eerlijk te zijn ... geen idee waarom het werkt
en daarnaast, Als ik 'm van m'n testserver afhaal:
1) volstaat het dan om alles weer als in de oude htaccess te zetten?
2) óf moet ik hierin ook zaken wijzigen?

Re: installatie overgezet, alleen index te zien

Posted: Thu May 28, 2020 9:15 am
by musicscore
Heb je in de config.php onderstaande al geprobeerd :

Code: Select all

$config['root_url'] = 'https://www.mysite.com';
Zelf ontwikkel ik altijd op een test server onder een andere domeinnaam en zet dan de website over (via een ftp kopie.
Let er wel op dat je een aantal folders op full access moet zetten (777) zoals bv de cache en upload folders.

Re: installatie overgezet, alleen index te zien

Posted: Thu May 28, 2020 10:39 am
by erpee
@musicscore

Dat stuk heb ik idd al wel geregeld.
Daarnaast werk ik met een lokale testserver en dat vraagt net weer een iets andere opzet dan een testserver op afstand.

Re: installatie overgezet, alleen index te zien

Posted: Thu May 28, 2020 10:45 am
by janvl
ik kan je aanraden om in je htaccess eerst alle kommentaren te verwijderen, dan alle overbodige regels voor veiligheid, comprimeren etc. weg te halen zodat je een hele kleine htaccess overhoudt.

Ook bij je config.php alles verwijderen dat niet met de basale funkties te maken heeft.

Als je website dan funktioneert, dan kun je stap voor stap toevoegen en merk je vanzelf waar het fout gaat. Ik had dat met de komprimering.

Met Firefox en de tools voor ontwikkelaars vindt je vaak waar het haakt of je kijkt in je PHP errorlogs.

Staat die site online, heb je een link?

MvG
Jan

Re: installatie overgezet, alleen index te zien

Posted: Thu May 28, 2020 11:27 am
by Rolf
Heb je de database ook daadwerkelijk geimporteerd op de nieuwe server?!

Re: installatie overgezet, alleen index te zien

Posted: Fri May 29, 2020 12:12 pm
by erpee
Ja hoor, die staat op de nieuwe server.

Re: installatie overgezet, alleen index te zien

Posted: Fri May 29, 2020 1:32 pm
by musicscore
Heb je al gekeken naar de PHP versie op je doel server. Klopt die met de specs.

Re: installatie overgezet, alleen index te zien

Posted: Fri May 29, 2020 1:40 pm
by erpee
Even voor de duidelijkheid.... Het werkt wel maar ik vraag me dus vooral af WAAROM het werkt door dit stuk te remarken:

Code: Select all

# +++++ ADD THIS - START +++++
  # Link to http(s)://website... then redirect to https://www.website...
  #RewriteCond %{HTTP_HOST} !^www\. [NC]
  #RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

  # Force URLs have https instead of http
  #RewriteCond %{HTTPS} off
  #RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# +++++ ADD THIS - END +++++
En daarbij de vraag ... Wat moet ik met de htaccess doen als ik het weer op een gewone server (https) plaats.
'Gewoon' un-remarken? Er van uitgaande dat de site in dezelfde sub-dir komt natuurlijk.

Re: installatie overgezet, alleen index te zien

Posted: Fri May 29, 2020 2:12 pm
by janvl
even zo uit de onderbuik, in het bovenste deel schakel je om naar "https met www".
De onderste regel wordt nooit aan voldaan omdat je al https hebt.

mvg
Jan