Jump to content

Moving PW from a root folder into a subfolder


itsberni
 Share

Recommended Posts

hey guys,

i´m moving a pw-site from a dev-enviroment to a server.
on mamp pw was installed in the root-directory. on the server pw is installed at a folder called "pw".
i moved the files and the database - adjusted the hoster settings by pointing on this certain "pw" - folder. so far - so good.
pw worked but my links to the css & js-files are out of function.
the firebug reads my link as follows:

http://www.mysite.desite/templates/css/min/all-min.css

( a slash is missing ).

i tried to set the path of the templates with

$config->urls->templates = "/pw/site/templates/";

- but without any success.

do you guys have any suggestions how th fix that?!

Thanks

Link to comment
Share on other sites

can you post how you are calling the assets?

the correct way would be something like:

<link rel="stylesheet" type="text/css" href="<?=$config->urls->templates?>css/min/all-min.css" />

also make sure you enable this line the htaccess file:

RewriteBase /pw/
  • Like 1
Link to comment
Share on other sites

Hey Macrura,

thanks for replying.

I call the assets in the same way you postet it.

  <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>css/min/all-min.css" />

when i enabling the line in the htaccess

  RewriteBase /pw/

i get an error 500 when clicking on any page

The slash after www.mysite.de is furthermore missing.

...helpless :'(

Link to comment
Share on other sites

So you are pointing a domain to a subfolder through your hostingpanel? I would contact them since I suspect there might be something off they way the forward the traffic. Are other websites running well with this configuration?

Link to comment
Share on other sites

Exactly....

I think so - i switched the cms-system from contao to processwire. The contao-cms runs well with the same server configuration, but in the "contao" - folder.

So i would say, there is nothing wrong with the Server configuration...

Link to comment
Share on other sites

I wouldn't blindly rule out server configuration just because another cms does work. Wordpress for example just stores the domain name in the db and therefore doesn't rely on any server information when building links, while ProcessWire does not know anything about the domain upfront, but parses it from multiple possible server / php globals. 

Link to comment
Share on other sites

Exactly my point LostKobrakai. I have experience with a hosting provider which had a similar setup to itsberni's hosting provider. You had to point the domain to folder in the public_html. Therefore I had to rewrite the root url to / instead of letting ProcessWire determine the root url.

Link to comment
Share on other sites

the point is, that my experience with this hoster in that case isn´t "bad". That means i have several sites running with this hoster in a "pw" folder within the "html"-folder. the difference might be, that in my developing eviroment ( mamp pro ) a "pw"-folder doesn´t exist ( on the mac-ssd it´slike: iitsberni->projects->customer ).

so, i did nothing else different than in other dev-prozesses within other projects.

Link to comment
Share on other sites

i tried this...but it seems to be ignored or "missunderstood" by the hosters ( Mittwald ) settings in the customers area. Its caused by the fact that you HAVE TO do a redirection for your domain(s) to a.) a folder b.) a software(CMS) or c.) to another Domain.

so, in my case i've got the choice between a.) or c.)
 

if i chose a.) on one Domain ( non-www or www ) and c.) on the other domain i will get the issue i postet

if i do a mixture between .htaccess an hoster setting a.) or c.) it will fail

maybe i should do a redirect to the root-folder for both domains ( non-www or www ) via the hoster and try to do all the redirections via .htaccess, like you suggested it, arjen?!

Link to comment
Share on other sites

So if i understand correctly, with option A you need to chose a folder that wil then act as the document root for a certain domain.

So the directory called 'pw' is the root for 'mydomain.com'. The www.mydomain.com version technically is just a subdomain of mydomain.com. You could run two completely different sites on the www and non-www versions if you wanted to.

With most of the hosting companies you don't have to manually setup anything for the www subdomain, but in this case you might have to. You can then choose to use .htaccess to rewrite the www version to non-www or vice versa. This is good practice for potential duplicate content you mentioned.

To summarize, i think you should only work with option A and then use htaccess to do the rewrites.

I would just call your hoster if you have trouble setting things up correctly.

Link to comment
Share on other sites

hey folks, this is quite weird....

when i do a redirection with the non-www version to the "pw" folder and redirect the www-version to the non-www version --> it works!
If i do that vice versa it won´t :'( - same issue!

But in this case when i write www.mysite.de/mypage/ the cms (or the hoster configuration?! ) does www.mysite.demypage and cuts out any slash.

i also tried to do nothing ( no redirections ) in the hosers customers board and do all the stuff via .htaccess.
If i do this the rewrite-base /pw/ is ignored totally but the domain redirection from non-www to the www-version works.

Arrggghh >:(

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.
×
×
  • Create New...