Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Adding a site url to images/files only
I am creating a mobile version of my site on a sub domain, by chaning some of the txpath directories to where the full site resides (on the same server) which works by using the same database etc.
First problem I had was about all the Permlinks used that when clicked on the mobile version went to the full site because of the site url I had set in the admin. I got around this by removing that in the admin, so it now defaults to the current domain, but this now has removed the link to all images etc as I have obviously removed the site url ref.
The two sites are
www.oliverker.co.uk (full site)
m.oliverker.co.uk (mobile)
So what I would like to do is only on the m.oliverker.co.uk site is to reference the images and files on the full site url, how can I do this?
note I have actually set up a mobile version using cookie plug in on the full site, but doesn’t work properly when switching between the two versions it alters the viewport incorrectly.
Offline
Re: Adding a site url to images/files only
What about just symlinking the folders containing those resources (files and images) from your subdomain folder?
Offline
Re: Adding a site url to images/files only
How do I do that? : )
Offline
Re: Adding a site url to images/files only
The easiest way would be if you have shell access to your hosting space, and use a linux/mac terminal to log in to it. Probably, in your hosting panel, you will be able to enable this kind of access.
Once you are in, you go to the folder where you would like to create your symlink, and create the symlink there.
If you have shell access, and accessed successfully, you will be able to create symlinks running a few commands.
I’ll be assuming that your website is located on: /home/oliverker/public_html/
and your mobile version is on /home/oliverker/public_html/mobile
.
So, images and files are in /home/oliverker/public_html/images/
and /home/oliverker/public_html/files/
$:
$:pwd #print current working directory
/home/oliverker/public_html/
$:cd mobile #of course, I'm inventing
$:pwd #print current working directory
/home/oliverker/public_html/mobile/
$:ln -s /home/oliverker/public_html/images images # this creates a symlink to the real images folder, and names it "images"
$:ln -s /home/oliverker/public_html/files files # this creates a symlink to the real files folder, and names it "files"
$: ls -l #run this to see if the symlinks you just created are there :)
Oliver, this is just possible one method to create symlinks.
And also, this is just one possible method of trying to solve your initial problem. There are other alternatives, like creating a txp:variable
with the full/absolute path to your resources, and prepend it on href
or src
where needed.
Offline
Re: Adding a site url to images/files only
cheers Julián
I figured out a way,
I added
redirect /images/ http://www.mainsite.com/images
and that seemed to work.
Offline