Linking to files in Expression Engine templates (path name problems) - expressionengine

Hey, new to expression engine - loving it, but having difficulties with linking to external files. I know this differs from server to server, but at present I see no end to these woes and would appreciate a nudge in the right direction. Server issues of any shade tend to give me panic attacks. They are my kryptonite.
1) Expression Engine 2.1 is installed in a subfolder of our site (www.website.com/client)
2) I have made a template group and set it up to save as files, and uploaded a logo within a subfolder (system/expressionengine/templates/default_site/site.group/images/logo.jpg)
Linking to either (www.website.com/client/images/logo.jpg) links to naught. Neither do longer variations like (www.website.com/client/system/expressionengine/templates/default_site/site.group/images/logo.jpg)
Halp.

Template groups are not meant to hold that kind of static content, /templates is not public (at our install it is even outisde of www).
You need to change your upload folder to /client/themes/uploads or something similar, then you can access your uploads as {path=themes/uploads}/image_name.jpg

try using the path: /images/logo.jpg or /client/images/logo.jpg
Also, direct those questions to http://expressionengine.com/forums/viewforum/113/
you'll receive help from a larger pool of knowledgeable users.

Related

How to use Intersphinx to link documents when the underlying domain will change?

I have a use case for reStructured Text documentation in an offline scenario. It will move from one domain to another when installed and often No Internet access will be available. I'm assuming HTML output of sphinx. I have multiple microservice projects that I'd like to be able to share links between them using Intersphinx. The projects will ride together and someone browsing one project will have access to the others. I expect they could always be arranged to be in a project folder on the same top level domain even.
All the examples I see on the Internet seem to assume that a static domain will be in use and the documentation isn't copied to new places. Is there some way to easily account for a changing domain?
An additional concern that maybe covers the previous is relative linking. Can we account for the domain change in a way that won't require me to rebuild the docs? In HTML I'd have links to "/some/page.html" instead of "http://example.com/some/page.html".
Sounds like you're just looking to use relative paths instead of domain names. If that's the case, you would do something like this in your conf.py:
intersphinx_mapping = {
'other': ('example/', 'example/example.inv'),
}
From the intersphinx extension docs:
Relative local paths for target locations are taken as relative to the base of the built documentation, while relative local paths for inventory locations are taken as relative to the source directory.

Get all files located on a server?

I'm trying to find all of the (javascript) resources located on a specific site.
What would be a efficient way of finding them?
Everything I could think of is bruteforcing every possible name and check whether there's a file with this name at the server, although this isn't exactly that efficient.
Yes you can do this. The thing which you actually want to do is web directory traversal..
It is a kind of web vulnerability which is usually taken in to consideration by the web master so you get 403-Forbidden or 404-Not Found Error. Manual exploitation on this is surely possible with trial and error basis in case u get to know directory that contains .js files. For automation You can take use of Python/Perl for ease of use. I am personally working on a same project targeting the same objective using PHP and cURL. At very present I can not help about any source code but for sure I'll be posting same.

Trying to move Drupal install TO subdirectory

Okay, so I've searched everywhere and while I can find plenty of stuff about moving a Drupal install out of a subdirectory I can't find anything on moving one into a subdirectory. I've recently taken over this project and it was developed without me so I've been landed in it here.
The problem is that the site was developed in the root of a dev server and I now have someone who wants it in a subdir. I've changed the base url in the htaccess and I've tried manually changing references in the CSS and DB but I can't be sure I've caught everything (modules etc).
What I want to know is, is there a way to force every link relative to the root to be relative to root/example instead. Basically everything that was once at www.example.com is now at www.example.com/subdirectory.
Thanks.
There's two pieces to this. The first you've already done: configuring htaccess to set a base url that includes the subdirectory.
Unfortunately, you may have quite a few references in the node content (especially embedded images) that will stop working.
A relatively simple solution to this would be to include a <base href="foo.com/dir" /> tag in your site theme, but this isn't a great fix in the long term.
You can try modifying your database directly, through queries such as the following (use with care, backup your database ahead of time, etc):
UPDATE field_revision_body SET body_value = REPLACE(body_value, 'devdomain.com', 'proddomain.com/subdir') (add http:// into those queries)
You may also need to update the paths in your files table to reflect the new locations on disk, especially if you're using multisite.
Alternately, have you considered using the Backup & Migrate module to move content from the dev server to a new install at the new instance?

Limit IIS virtual Directories pointing to same folder path

I have an asp.net project that I use for a couple different purposes. We have addresses that access the same virtual directory via different paths (use1.company.com and use2.company.com) I do not want to break the project up as they use similar functionality that seems redundant to have in two places. None the less as it stands use1.company.com/default.aspx and use2.company.com/default.aspx both are the same. I want to make it so that use2.company.aspx/default.aspx is not accessible. Is there a way to do that from the App Pool/Virtual Directory settings or do I just have to hope that external users dont type /default.aspx?
I know I can set the default document to like survey.aspx (purpose of the second url) but that does not prevent some savvy users from typing in default.aspx just to see what it does. Any assistance here would be great.
Since they point to the same .aspx file could you not include an if statement at the start of the file to grab the URL and if it includes use2 then go back?

How do I move ExpressionEngine (EE) to another server?

What are the best steps to take to prevent bugs and/or data loss in moving servers?
EDIT: Solved, but I should specify I mean in the typical shared hosting environment e.g. DreamHost or GoDaddy.
Bootstrap config is the smartest method (Newism has a free bootstrap config module). I think it works best on fresh installs myself, but ymmv.
If you've been given an existing EE system and need to move it, there are a few simple tools that can help:
REElocate: all the EE 2.x path and config options, in one place. Swap one URL for another in setup, check what's being set and push the button.
Greenery: Again, one module to rule them all. I've not used this but it's got a good rating.
So install, set permissions, move files and and DB, and then use either free module. If you find that not all the images or CSS instantly comes back online, check your template base paths (in template prefs) and permissions.
I'm also presuming you have access to the old DB. If not, and you can't add something simple like PHPMyAdmin to back it up, try:
Backup Pro(ish): A free backup module for files and db. Easy enough that you should introduce it to the site users (most never consider backups). All done through the EE CP. The zipped output can easily be moved to the new server.
The EE User Guide offers a reasonably extensive guide to Moving ExpressionEngine to Another Server and if you follow all of these steps then you will have everything you need to try again if any bugs or data loss occur.
Verify Server Compatibility
Synchronize Templates
Back-up Database and Files
Prepare the New Database
Copy Files and Folders
Verify File Permissions
Update database.php
Verify index.php and admin.php
Log In and Update Paths
Clear Caches
As suggested by Bitmanic, a dynamic config.php file helps with moving environments tremendously. Check out Leevi Graham's Config Bootstrap for a quick and simple solution. This is helpful for dev/staging/prod environments too!
I'd say the answer is the same as any other system -- export your entire database, and download all of your files (both system and anything uploaded by users - images, etc). Then, mirror this process by importing/uploading to the new server.
Before I run my export, I like to use the Deeploy Helper module to change all of my file paths in EE to the new server's settings.
Preventing data loss primarily revolves around the database and upload directories.
Does your website allow users to interact with the database? If so at some point you'll need to turn off EE to prevent DB changes. If not that you don't have too much to worry about as you can track and changes on the database end between the old and new servers.
Both Philip and Derek offer good advice for migrating EE. I've also found that having a bootstrap config file helps tremendously - especially since you can configure your file upload directories directly via config values now (as of EE2.4, I think).
For related information, please check out the answers to this similar Stack Overflow question.

Resources