Jump to content

Live Site Home URL


Gazley
 Share

Recommended Posts

Hi there,

Yep, this is a pretty dumb@$$ed question but I'll ask it anyway :)

In the CP, my very top level is "Home".

Against localhost, my browser URL shows:

http://localhost:8888/ProcessWire/

When the site goes live, in this case, I want it to show something like:

http://my-funky-new-site.co.uk/

Assuming I specify that the VirtualHost DocumentRoot value includes the "ProcessWire" folder (or whatever comparable folder it is on the server), will PW automatically handle/show the URL like:

http://my-funky-new-site.co.uk/

Thanks!

Link to comment
Share on other sites

PW doesn't care where you run it or whether you move it between subdirectories, etc. So you should be fine. The only thing you need to consider is local links you may have in a TinyMCE field. Since that is raw HTML that TinyMCE uses, it may have direct links in it (if you've inserted images or links through TinyMCE). In that case, you'd want to do an search/replace on your DB dump file replacing "/ProcessWire/" with "/", before importing to your live site. There is also a module that can manage this for you called PageLinkAbstractor (currently being re-worked under the name LinkManager). But this module is one you have to start with and stick with, so probably not as helpful here. But I usually just do the search/replace when migrating from a local subdirectory site to a live root level site. Again, only necessary if you've got image, file or URL links in your TinyMCE rich text fields and are switching from subdir to root.

  • Like 1
Link to comment
Share on other sites

Just to make sure; I assume that http://my-funky-new-site.co.uk/ points directly to your docroot on the webserver?

In that case you would upload the contents of your ProcessWire to the docroot and not the directory and it's contents. In other words, normally there won't be a ProcessWire dir on your live site. Only site and wire dirs and ofcourse .htaccess etc.

Maybe obvious but thought i'd mention it.

Link to comment
Share on other sites

Hi SiNNuT,

Thanks for chiming in. Well, this was really the nub of the question. If I did include ProcessWire in the docroot, then in the VirtualHost setting for the site, I would have set the DocumentRoot value to something like "/var/www/htdocs/ProcessWire". In this case, I assume that would work.

Other than that, "/var/www/htdocs/" would contain only "site", "wire" and ".htaccess" as you suggest. I guess that by keeping "site", "wire" and ".htaccess" in a site-specific subdirectory off of the docroot, I could potentially have more than one PW site hosted by my dedicated server.

Does all this sound about right to you?

Cheers! :)

Link to comment
Share on other sites

Basically you can put the PW anywhere. But if you want "clean" domain (no subdirectories) then just make sure you point your docroot where your index.php is (and wire and site directories).

You can even "nest" pw installations. You can run one site at www.cooldomain.com and yet another at www.cooldomain.com/subsite/. It just doesn't care. Coolest part of that: http://processwire.com/api/include/

Other than that, "/var/www/htdocs/" would contain only "site", "wire" and ".htaccess" as you suggest. I guess that by keeping "site", "wire" and ".htaccess" in a site-specific subdirectory off of the docroot, I could potentially have more than one PW site hosted by my dedicated server.

I would but it this way:

/var/www/htdocs/coolsite.com/

/var/www/htdocs/anothersite.com/

etc.. (also you might want to make the path simpler, like /www/coolsite.com/ etc..)

This way it is clean and simple, and allows multiple domains/sites from your server.

  • Like 1
Link to comment
Share on other sites

/var/www/htdocs/coolsite.com/

/var/www/htdocs/anothersite.com/

So, two VirtualHost files specifying docroots matching the above paths, with wire/site/index.php in each folder. Cool!

Thanks apeisa :)

Link to comment
Share on other sites

This is quite an interesting topic. Up until now i have only deployed to shared hosting with all of the stuff directly in the docroot.

Sometimes you read that it is considered 'wise' to have as much as possible outside of the document root and maybe only keep an index.php and htaccess and your assets in there.

Any of you work this way? That would mean altering the paths in PW but i guess it could be done?

Link to comment
Share on other sites

Sometimes you read that it is considered 'wise' to have as much as possible outside of the document root and maybe only keep an index.php and htaccess and your assets in there. Any of you work this way? That would mean altering the paths in PW but i guess it could be done?

This isn't far off from what PW is trying to do, at least relative to other systems out there. The only things we have in root are:

/index.php

/wire/

/site/

/.htaccess

There are a few readme/txt files in there, which of course are just for initial reference and don't need to stick around with the site.

It is no problem to make your /wire/ a symlink to a shared /wire/ directory located somewhere else. But probably best to keep /site/ where it is.

Link to comment
Share on other sites

  • 9 years later...

I put the site, wire, .htaccess and index.php in my docroot folder and also made sure to give read and write permissions to the necessary folders which is site/assets, site/modules, site/assets/cache, site/assets/files, site/assets/logs. But when I open the website domain, I get these errors. My docroot points to /var/www/html/test_website.


Warning: file_put_contents(/var/www/html/test_website/site/assets/cache/FileCompiler/site/templates/home.php): failed to open stream: Permission denied in /var/www/html/test_website/wire/core/FileCompiler.php on line 400

Warning: fopen(/var/www/html/test_website/site/assets/logs/file-compiler.txt): failed to open stream: Permission denied in /var/www/html/test_website/wire/core/FileLog.php on line 164

Anything I might be missing?

Link to comment
Share on other sites

On 10/5/2021 at 5:12 AM, Siddhi Jagtap said:

I put the site, wire, .htaccess and index.php in my docroot folder and also made sure to give read and write permissions to the necessary folders which is site/assets, site/modules, site/assets/cache, site/assets/files, site/assets/logs. But when I open the website domain, I get these errors. My docroot points to /var/www/html/test_website.


Warning: file_put_contents(/var/www/html/test_website/site/assets/cache/FileCompiler/site/templates/home.php): failed to open stream: Permission denied in /var/www/html/test_website/wire/core/FileCompiler.php on line 400

Warning: fopen(/var/www/html/test_website/site/assets/logs/file-compiler.txt): failed to open stream: Permission denied in /var/www/html/test_website/wire/core/FileLog.php on line 164

Anything I might be missing?

@Siddhi Jagtap is this still an issue for you ?  thought you have fixed it. 

Link to comment
Share on other sites

  • 3 weeks later...
On 10/4/2021 at 11:12 PM, Siddhi Jagtap said:

I put the site, wire, .htaccess and index.php in my docroot folder and also made sure to give read and write permissions to the necessary folders which is site/assets, site/modules, site/assets/cache, site/assets/files, site/assets/logs. But when I open the website domain, I get these errors. My docroot points to /var/www/html/test_website.


Warning: file_put_contents(/var/www/html/test_website/site/assets/cache/FileCompiler/site/templates/home.php): failed to open stream: Permission denied in /var/www/html/test_website/wire/core/FileCompiler.php on line 400

Warning: fopen(/var/www/html/test_website/site/assets/logs/file-compiler.txt): failed to open stream: Permission denied in /var/www/html/test_website/wire/core/FileLog.php on line 164

Anything I might be missing?

On 10/6/2021 at 3:44 AM, JeevanisM said:

@Siddhi Jagtap is this still an issue for you ?  thought you have fixed it. 

Hello all!

I figured it would be okay to post this here since the quoted post was recent and it's related.

Okay, for starters, I'm very inexperienced with PW.  Due to this, I installed PW using my hoster's (https://ibrave.io/) so called "One-Click Install", which appears to have placed site, wire, .htaccess, and index.php in the public_html dir.  Because there is one level above the public_html dir that contains only the public_html dir and another .htacess file, I'm assuming it's the "root".  Please advise if this is incorrect?

After creating the required database file and running the One-Click installation, I created a new directory "Original" and  copied the contents of root to it.  Because I wanted a localhost duplicate, I FTP'd  the contents of the "Original" directory to
C:\xampp\htdocs on my PC to play with using XAMPP.

I realize I will most likely need to modify some of the local config files to get it to function.  Does anyone have a link to a list of which files and what modifications?  Also, if there are any reasons that this is a bad idea, please let me know.

Thanks!

 
 
 

 
 
 

 
 
Link to comment
Share on other sites

11 hours ago, Gideon So said:

Hi @nozero

I believe the only file you need to modify is config.php.

You need to modify the following:

1. $config->httpHosts

I wonder if your hosting company allow remote access to the DB server.

Gideon

Gideon,

Thanks for the info!  I will check with iBrave.io on remote access to the DB.

nozero

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Similar Content

    • By Liam88
      Hi,

      After years of just playing around with Processwire I have asked 3 q's in the same week. It's all about working with forms, parameters etc and so I'm hoping this ordeal is nearly over!
      I currently have a checkbox filter:
      <form id="abFilter" method="get" role="form" action="'.$page->url().'"> <div class="list-group"> <h3>Content Type</h3>'; $cont = $fields->get('ab_content'); $contents = $cont->type->getOptions($cont); foreach($contents as $ab_cont){ echo' <div class="list-group-item checkbox"> <input type="checkbox" class="" id="'.$ab_cont->title.'" name="content" value="'.$ab_cont->title.'"'; if (in_array($ab_cont->title, $contArray)){ echo "checked"; } echo'> <label for="'.$ab_cont->title.'">'.$ab_cont->title.'</label> </div>'; } echo' </div>'; //end of filter 1 //start of filter 2 echo' <div class="list-group"> <h3>Channels</h3>'; $chan = $fields->get('ab_channels'); $channel = $chan->type->getOptions($chan); foreach($channel as $ab_chan){ echo' <div class="list-group-item checkbox"> <input type="checkbox" class="" id="'.$ab_chan->title.'" name="channel" value="'.$ab_chan->title.'"'; if (in_array($ab_chan->title, $chanArray)){ echo "checked"; } echo'> <label for="'.$ab_chan->title.'">'.$ab_chan->title.'</label> </div>'; } echo' </div>'; ?> <button id="select">Get Checked Checkboxes</button> </form><!-- end of form --> I also have a piece of script which selects all the checkboxes and then outputs them into readable parameters for the URL which then passes into the $inputs. The reason for the script is to not have duplicate filters like ?ab=1&ab=2 and the script changes it to ab=1_2 which on the input gets exploded into an array. 
      document.querySelector("form").onsubmit=ev=>{ ev.preventDefault(); let o={}; ev.target.querySelectorAll("[name]:checked").forEach(el=>{ (o[el.name]=o[el.name]||[]).push(el.value)}) console.log(location.pathname+"?"+Object.entries(o).map(([v,f])=>v+"="+f.join("_")).join("&")); document.location.href = location.pathname+"?"+Object.entries(o).map(([v,f])=>v+"="+f.join("_")).join("&"); } Here is $inputs and so on on the page:
      //Default selector to get ALL products $baseSelector = "template='adbank_pages',sort=published,include=all,status!=hidden,limit=2"; $selector = "template='adbank_pages',sort=published,include=all,status!=hidden,limit=2"; $input->whitelist('channel',explode("_", $channel)); // Use this to append to the $items filter if($channel){ $chanArray = explode("_", $channel); $chan = $channel = str_replace('_', '|', $channel); $selector = $selector .= ",ab_channels=$chan"; } $test = $pages->find($selector); // This is just testing if the $selector choise returns and if not use page filter without filters. if(count($test) > 0){ $items = $pages->find($selector); // $items with the parameter filter // Example - "template='adbank_pages',sort=published,include=all,status!=hidden,limit=2,ab_channels=facebook-ads" // Example (multi choice) - "template='adbank_pages',sort=published,include=all,status!=hidden,limit=2,ab_channels=facebook-ads|instagram-ads" // Example (with other filters) - "template='adbank_pages',sort=published,include=all,status!=hidden,limit=2,ab_channels=facebook-ads,ab_content=video|static" }else{ $items = $pages->find($baseSelector); // Example - "template='adbank_pages',sort=published,include=all,status!=hidden,limit=2" } $total = $items->getTotal(); I have stripped out a few of the other filters from the above to try keep it a little more concise (haha). Now I appreciate the post may be long but here we are at the end!
      The URL I get on page 1 of the filter results would look like: example.com/blog/?channel=facebook-ads_instagram-ads
      If I click page 2 the url changes to - example.com/blog/page2/?channel=
      If I then click back to page 1 it changes to - example.com/blog/?channel=
      So I'm hoping you can see my problem and hoping someone can assist. I need to work out how to keep the parameters in the url but also if I remove that filter for that parameter to remove.
      This whole process works without pagination but with pagination it has a different behaviour.
      Thank you in advance
    • By humanafterall
      Hi,
      I have a URL field that will sometimes have relative/local URLs on a multilingual site, for example /contact/ 

      However the URL field does not seem to pick up when I'm on another language, for example /fr/ so I'm taken to the default language page for /contact/ rather than /fr/contact/
      Is there a way to make the URL fields play well with a multi-language site?
      Thanks!
       
    • By Robin S
      A new module that hasn't had a lot of testing yet. Please do your own testing before deploying on any production website.
      Custom Paths
      Allows any page to have a custom path/URL.
      Note: Custom Paths is incompatible with the core LanguageSupportPageNames module. I have no experience working with LanguageSupportPageNames or multi-language sites in general so I'm not in a position to work out if a fix is possible. If anyone with multi-language experience can contribute a fix it would be much appreciated!
      Screenshot

      Usage
      The module creates a field named custom_path on install. Add the custom_path field to the template of any page you want to set a custom path for. Whatever path is entered into this field determines the path and URL of the page ($page->path and $page->url). Page numbers and URL segments are supported if these are enabled for the template, and previous custom paths are managed by PagePathHistory if that module is installed.
      The custom_path field appears on the Settings tab in Page Edit by default but there is an option in the module configuration to disable this if you want to position the field among the other template fields.
      If the custom_path field is populated for a page it should be a path that is relative to the site root and that starts with a forward slash. The module prevents the same custom path being set for more than one page.
      The custom_path value takes precedence over any ProcessWire path. You can even override the Home page by setting a custom path of "/" for a page.
      It is highly recommended to set access controls on the custom_path field so that only privileged roles can edit it: superuser-only is recommended.
      It is up to the user to set and maintain suitable custom paths for any pages where the module is in use. Make sure your custom paths are compatible with ProcessWire's $config and .htaccess settings, and if you are basing the custom path on the names of parent pages you will probably want to have a strategy for updating custom paths if parent pages are renamed or moved.
      Example hooks to Pages::saveReady
      You might want to use a Pages::saveReady hook to automatically set the custom path for some pages. Below are a couple of examples.
      1. In this example the start of the custom path is fixed but the end of the path will update dynamically according to the name of the page:
      $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'my_template') { $page->custom_path = "/some-custom/path-segments/$page->name/"; } }); 2. The Custom Paths module adds a new Page::realPath method/property that can be used to get the "real" ProcessWire path to a page that might have a custom path set. In this example the custom path for news items is derived from the real ProcessWire path but a parent named "news-items" is removed:
      $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'news_item') { $page->custom_path = str_replace('/news-items/', '/', $page->realPath); } }); Caveats
      The custom paths will be used automatically for links created in CKEditor fields, but if you have the "link abstraction" option enabled for CKEditor fields (Details > Markup/HTML (Content Type) > HTML Options) then you will see notices from MarkupQA warning you that it is unable to resolve the links.
      Installation
      Install the Custom Paths module.
      Uninstallation
      The custom_path field is not automatically deleted when the module is uninstalled. You can delete it manually if the field is no longer needed.
       
      https://github.com/Toutouwai/CustomPaths
      https://modules.processwire.com/modules/custom-paths/
    • By AndZyk
      Hello,
      I am currently building a intranet which will be hosted on the local network of a company. This intranet has many links to files on their fileserver with the protocol file://.
      So for example the links look like this file://domain.tld/filename.ext
      When I try to insert such a link into a URL field, I get the error, that only the protocol http:// is allowed. When I try to insert such a link into a CKEeditor link, it gets stripped out. Is it possible to insert such links into the FieldType URL and CKEditor.
      I know that I could use a FieldType Text or insert a RewriteRule in the .htaccess file, but I am looking for a more elegant solution. 😉
      Regards, Andreas
    • By stanoliver
      Hi! 
      The following code snippet is part of my markup simple navigation and the url_redirect (url field in the backend) just works fine when I put an special custom url into the url_redirect field.
      <?php $nav = $modules->get("MarkupSimpleNavigation"); // topnav $current = $page->rootParent(); // current root page // subnav echo $nav->render(array( 'max_levels' => 2, 'item_tpl' => '<h4><a class="g8-bar-item g8-hover-black" href="{url_redirect|url}">{title}</a></h4><hr class="sidenav">', 'collapsed' => true, ), $page, $current); ?>  In my seperated breadcrumb navigation I use the following code snippet
      <?php foreach($page->parents()->append($page) as $parent) { echo "<li><a href='{$parent->url_redirect|url}'>{$parent->title}</a></li>"; } ?> Now to the problem: In my first code snippet above the
      url_redirect|url 
      works just fine but when I try something similiar in the second code snippet
      $parent->url_redirect|url
      I produce an server error How do I have to change the second code snippet so that it works in the correct way as the first code snippet does?
×
×
  • Create New...