I’m running Kirby on shared hosting with A Small Orange. The shared hosting has a url like https://subdomain.maindomain.com/~username
Today I set up my domain A Record (under a different registrar) and Cloudflare (using their nameservers).
I’m observing the following behavior:
- Go to https://mysite.com
- Click on a nav link created using
<a href="<?php echo $p->url() ?>"> - Land on https://mysite.com/mylinkworks
- Observe that now the nav links are all https://mysite.com/~username/badlink
- Click on a nav link
- Land on https://mysite.com/~username/badlink
What is up?
relevant .htaccess:
# rewrite rules
<IfModule mod_rewrite.c>
# enable awesome urls. i.e.:
# http://yourdomain.com/about-us/team
RewriteEngine On
RewriteCond %{HTTP_PORT} 80 [OR]
RewriteCond %{HTTP_HOST} ^www\.mysite\.vc$ [NC]
RewriteRule ^(.*)$ https://mysite.vc/$1 [R=301,L]
# make sure to set the RewriteBase correctly
# if you are running the site in a subfolder.
# Otherwise links or the entire site will break.
#
# If your homepage is http://yourdomain.com/mysite
# Set the RewriteBase to:
#
RewriteBase /~username
# block text files in the content folder from being accessed directly
RewriteRule ^content/(.*)\.(txt|md|mdown)$ index.php [L]
# block all files in the site folder from being accessed directly
RewriteRule ^site/(.*) index.php [L]
# block all files in the kirby folder from being accessed directly
RewriteRule ^kirby/(.*) index.php [L]
# make panel links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^panel/(.*) panel/index.php [L]
# make site links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]
</IfModule>