Base path & rewrites fail when installing in sub folder
It seems that if Wordpress is installed in a subfolder of a domain (eg. localhost/mysite) then the rewrite rules don't work and calls to CSS / JS files point towards the wrong path.
On inspecting the source, the URLs come out as follows:
/mysite/wp-content/mysite/wp-content/themes/[roots_folder]/css/bootstrap.css
So the first part of the URL is duplicated. I can workaround this issue by hard coding the base folder through scripts.php, but obviously this needs configuring on every install and needs to change on migration to a live server.
get_template_directory_uri() is returning the correct path, so something else must be appending the extra subdirectory on the beginning.
To test, I setup a Wordpress install in a subfolder on my localhost, but setup a vhost / hosts file rewrite so the site is accessible via wpsandbox.local. This works absolutely fine.
I work out of of sub folders with Wampserver and don't have any issues.. that said sometimes i do need to delete the .htaccess file and re-activate the theme.
This is a strange one as it does not happen to everyone, my last few installs have been fine.
there is already an issue open for this.
#395 - there's also a fix in there.
Ah OK, thanks for letting me know. I did have a look around but couldn't find anything related to this issue, thanks for flagging it up.
I have the last version of Roots installed from github, but removing get_template_directory_uri() in inc/scripts.php is not helping me. I have the same wrong paths in html:
link rel="stylesheet" href=/wp/css/bootstrap.css
link rel="stylesheet" href=/wp/css/bootstrap-responsive.css
link rel="stylesheet" href=/wp/css/app.css
Wordpress was installed in /wp/ subdir.
Try turning permalinks on and off, and if that doesn't help then check your .htaccess file and see if the Wordpress specific rules are at the top. Haven't confirmed this 100% myself, but it helped a colleague.
Jon Martin BigSpring Web Development Office: 0845 519 0538 / +44 115 714 2282 Mobile: + 44 (0) 7787 121897 Skype: jon.bigspring http://www.bigspring.co.uk http://www.twitter.com/bigspringweb http://www.facebook.com/bigspringweb [email protected]
BigSpring is a trading division of Big Spring (UK) Ltd Registered in England & Wales No. 06741331, 29 St Austins Drive, Nottingham, NG4 3EY
On 31 July 2012 20:42, ram108 < [email protected]
wrote:
I have the last version of Roots installed from github, but removing get_template_directory_uri() in inc/scripts.php is not helping me. I have the same wrong paths in html:
Wordpress was installed in /wp/ subdir and shotcuts does not work.
Reply to this email directly or view it on GitHub: https://github.com/retlehs/roots/issues/512#issuecomment-7409238
Didn't find solution, only to comment //add_theme_support('rewrite-urls'); in inc/config.php and have direct links.
Bump this issue. As of commit https://github.com/retlehs/roots/commit/f2699d453ba3427f6efdbb672796ba1006387410 I am experiencing the same issues described by @ram108
I'm having the same issue... Latest commit installed, removed get_template_directory_uri() from scripts.php but the html head still prints the wrong path for css... :(