roots / sage

WordPress starter theme with Laravel Blade components and templates, Tailwind CSS, and a modern development workflow
https://roots.io/sage/
MIT License
12.74k stars 3.06k forks source link

Roots can not find CSS and JS files #426

Closed plekter closed 12 years ago

plekter commented 12 years ago

Hello! I really like Roots and would love to tinker around but Ive gotten a small problem at hands. I have a fresh WP 3.3.2 installation and latest Roots cloned from here but after installation, it does not find the CSS and JS files declared in head.

I am not sure what the issue could be but Im sure Im not the only one. Anyone has any helpful information?

retlehs commented 12 years ago

please provide some more information.

plekter commented 12 years ago

Here is the site: http://haavistu.eu/roots/

I noticed that when I clicked the Activate button the first time and it took me to theme activation, the CSS and other files paths were working correctly when I checked homepage, but after I did theme activation, it got to what you can see @ http://haavistu.eu/roots/

Some bits about my hosting:

retlehs commented 12 years ago

what does your .htaccess file look like? have you flushed your permalinks?

plekter commented 12 years ago

Hello Ben.

My htaccess file under the /roots/ is the following:

BEGIN WordPress

RewriteEngine On RewriteBase /roots/ RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /roots/index.php [L]

END WordPress

I havent done anything to flush the permalinks, I am in a hurry right now but will go over it once I get back(no clue right now how to do it). If you have a pointers to some good material I am all ears. :)

ghost commented 12 years ago

same issue here. flushed permalinks to no avail. .htaccess in the root wp install shows boilerplate modifications and css rewrites.

asuh commented 12 years ago

This sounds like the exact same issue I wrote about in my issue thread but for a different reason. https://github.com/retlehs/roots/issues/425

ghost commented 12 years ago

i finished the activation page, though. something seems related to url rewrites.

gdub01 commented 12 years ago

I have the same issue - fresh install of wordpress and roots 5.1 and it can't find my css or js files.

expertpixels commented 12 years ago

Hey Ben,

Love the roots theme.... but have noticed the same issue as the people above.. i am at a loss as to why this is happening.. ive been working on my localhost and also live on a hg hosting account.. and am getting the same issue..

If i activate the theme via the wordpress admin.. without using the "Roots Theme Activation" / clicking the "Roots Theme Activation" save button my styling & scripts load fine... it's once clicking the save button under "Roots Theme Activation" that the styling and scripts no longer load...

Activating the theme via the wp admin panel WITHOUT clicking the save button under the "Roots Theme Activation" options page.. the style and scripts load fine.. but if i go to change the permalinks to anything other than default "http://localhost/wordpress/?p=123" the styling and scripts no longer load / work....

Ive also noticed that when clicking the "HOME" button in my roots top menu it links to when "http://localhost/" when my wordpress install is installed here: "http://localhost/wordpress/"

Hope this information helps fix this ASAP, in the mean time i will keep searching the the roots files trying to fix this issue / provide more information on this.

Regards, Darren

hixen commented 12 years ago

Don't know if this is related, but I had the same problems, this is how I fixed it.

  1. Check that your .htaccess file have write access.
  2. My .htaccess started with the BEGIN WORDPRESS... and after some lines of code, came the HTML5 BOILERPLATE stuff, switch em, so the HTML5 BOILERPLATE comes first.
  3. I know this is stupid, but clear you cache and refresh your browser.
expertpixels commented 12 years ago

Hi Hixen,

Ive tried all the above as you have mentioned and have not had any luck, ive tried several different .htaccess edits and still nothing is doing the trick.. really frustrating as i am trying to get my up and live today / over the weekend.. i mean ive got stuff i can still work on, but am just hoping that all the work on the css / template files has not got gone to waste.

(Hixen if you get a chance can you upload a copy of your .htaccess file to pastebin or something so i can compare any differences, CHEERS).

Will keep a close eye on this topic and hopefully we can get to the bottom of this.

Regards, Darren

hixen commented 12 years ago
  1. Try and activate another theme, and then reactive your roots theme.

Silly question, but are your re-writes working at all?

Here is my .htaccess http://pastebin.com/Kg9Musvb

expertpixels commented 12 years ago

Cheers for your quick response Hixen :)

Really trying to get this sorted asap.. Testing your .htaccess file now (really appreciate that).. And yes ive tried activating other themes etc..

ok i replace my .htaccess file with your one and the same issues is occurring.. the stylesheets are simply not being picked up when using any other permalink setting besides the default one.

My theme with default / ugly permalinks: http://i48.tinypic.com/6qy1vl.png

My theme with default / ugly permalinks: http://i45.tinypic.com/10fym8k.png

Really at a lose here to understand whats going on... Will be online for the next 12 hours or so and will keep looking into this.

Thanks again for any help on this matter.

Regards, Darren

EDIT: yes my re-writes are working: http://localhost/wordpress/news/news-3/ <--- with updated permalinks, just no styling is applied at all.

hixen commented 12 years ago

It's your rewrite that is not turned on or is not working. (i think)

What setup do you have?

I should be in bed sleeping, but my 1 year old daughter have been screaming for the last 6 hours!

Skickat från min iPhone

5 maj 2012 kl. 02:22 skrev expertpixels reply@reply.github.com:

Cheers for your quick response Hixen :)

Really trying to get this sorted asap.. Testing your .htaccess file now (really appreciate that).. And yes ive tried activating other themes etc..

ok i replace my .htaccess file with your one and the same issues is occurring.. the stylesheets are simply not being picked up when using any other permalink setting besides the default one.

My theme with default / ugly permalinks: http://i48.tinypic.com/6qy1vl.png

My theme with default / ugly permalinks: http://i45.tinypic.com/10fym8k.png

Really at a lose here to understand whats going on... Will be online for the next 12 hours or so and will keep looking into this.

Thanks again for any help on this matter.

Regards, Darren


Reply to this email directly or view it on GitHub: https://github.com/retlehs/roots/issues/426#issuecomment-5522896

expertpixels commented 12 years ago

Get some sleep Hixen, i'll keep trying to sort this out..

On my localhost & live hostgator server my re-writes seem to be working fine.. all my links with different permalink settings are working fine, just no styling applied.

Running Xampp on windows 7.. ive added the re-write module / enabled rewrite_module

Cheers again

expertpixels commented 12 years ago

OK !!! ive managed a temporary fix to this...

I copied all folders from the roots theme into my installation directory: localhost/wordpress/ <--- copied the roots following folders here: css, img, js, lang, inc and now my site is working with permalinks and is displaying my stylesheets...

Now i am still none the wiser as to why ive had to do this.. from what i can tell my re-writes are working as permalinks for all other themes are running fine...

Hope this info helps to identify whatever is going on.

Regards, Darren

ghost commented 12 years ago

I just did a fresh install — WP 3.3.2 and the latest Roots 5.1, and am having the same problem — css and js are not found.

My .htaccess file is the default:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
gsonbuchner commented 12 years ago

moved to issue #395

expertpixels commented 12 years ago

Also due to this path issue ive noticed that when adding a new theme options page that some further issues are occurring: Warning: Cannot modify header information - headers already sent by

Also ive noticed that there are problems uploading attachments when trying to add a image to a posts / setting a featured image.

Lets try and get on top of this issues ASAP, I really love the roots theme and would love to get my project live asap, i am just unsure how much work to put into further development in case these issues are not fixed / no one can find a fix for this.

It's definitely a issue relating to the path.. even setting a "Home" page does not work.. I wish i could be of further assistance to the roots community but this problem has me stumped atm.

Regards, Darren

hixen commented 12 years ago

Check your settings > media

Or try and enable another theme and back.

Skickat från min iPhone

8 maj 2012 kl. 14:07 skrev rabhw reply@reply.github.com:

Just chiming in to say I've got a similar issue. My permalinks are working fine, but my uploads folder /assets/ is still trying to load assets from localhost, even though I've migrated my site from my local server to a staging server. I've obviously update the home / siteurl in the wp_options table. My permalinks are fully working, it's just the /assets/ folder that seems to still be getting directed to localhost.


Reply to this email directly or view it on GitHub: https://github.com/retlehs/roots/issues/426#issuecomment-5573081

rosslavery commented 12 years ago

Yeah my apologies, I'm an idiot. It wasn't that, it was something even more obvious. Just spent an hour troubleshooting when it was right in front of my eyes.

Sorry about that.

hixen commented 12 years ago

Been there myself ;)

Skickat från min iPhone

8 maj 2012 kl. 15:01 skrev rabhw reply@reply.github.com:

Yeah my apologies, I'm an idiot. It wasn't that, it was something even more obvious. Just spent an hour troubleshooting when it was right in front of my eyes.

Sorry about that.


Reply to this email directly or view it on GitHub: https://github.com/retlehs/roots/issues/426#issuecomment-5573945

Biwer21 commented 12 years ago

Anyone find a solution to this yet?

pmusaraj commented 12 years ago

Hixen's first answer worked for me. Enabling another theme, reenabling roots, reordering htaccess file and then clearing caches (or even better, turning caches off in Firefox using the Web Developer module) and then magically it worked!

plekter commented 12 years ago

Somehow worked for me too. :)

I copy-pasted the htaccess from hixens post and then followed his adwise.

Micebiz commented 12 years ago

Yea. Just activating Twenty Ten 1.3 theme and re-activate roots theme, then it worked!...

retlehs commented 12 years ago

is everyone sure that flushing / saving the permalinks isn't the only necessary step?

kmlx commented 12 years ago

Have the same problem. Fresh install: wordpress (latest) and roots (latest).

In the < head > section roots theme duplicates the whole path: < link rel="stylesheet" href="/www/ascensys/adrian/veggie/www/ascensys/adrian/veggie/css/bootstrap.css > should be < link rel="stylesheet" href="/www/ascensys/adrian/veggie/css/bootstrap.css" >

I saw line 57 in cleanup.php, but that only deals with subfolder duplication: /subfolder/subfolder/

Any ideas how to solve this? Permalink flushing doesn't work for me, and neither does re-activation.

kmlx commented 12 years ago

fixed it using this:

removed all instances of get_template_directory_uri() from /inc/scripts.php

retlehs commented 12 years ago

@kmix isn't your issue the same as #395?

kmix commented 12 years ago

I think you meant @kmlx.

-----Original Message----- From: Ben Word [mailto:reply@reply.github.com] Sent: Wednesday, May 16, 2012 23:56 To: kmix Subject: Re: [roots] Roots can not find CSS and JS files (#426)

@kmix isn't your issue the same as #395?


Reply to this email directly or view it on GitHub: https://github.com/retlehs/roots/issues/426#issuecomment-5758793

retlehs commented 12 years ago

haha, that's awesome. sorry @kmix ..apparently i need to wear my glasses in front of my laptop now too :)

kmlx commented 12 years ago

@retlehs i first posted here, afterwords finding out about #395. also posted there. so answer is 'yes'.

kmlx commented 12 years ago

@retlehs just tested now even though I remove get_template_directory_uri() from /inc/scripts.php I still have to activate roots, then activate some other theme, then get back to roots in order for the js and css files to work.

Mte90 commented 12 years ago

same problem when i activated permalink and the wordpress folder are in a subfolder of the root of the web server. :-/

expertpixels commented 12 years ago

might be cause by the root relative url's i noted some issues on my localhost but things are fine live / online.. check the config.php file in the includes folder.

retlehs commented 12 years ago

i still don't understand this issue. i'm convinced it's permalinks not flushed / .htaccess not writable & not getting the additional rules we add :/

expertpixels commented 12 years ago

yes it's a funny one.. but i think your correct, i think people should check their .htaccess files and double check that roots has updated it.

kmlx commented 12 years ago

@retlehs yes, you're right, but at the same time permalink flushing is not something i enjoy doing every time i start a new project.

what about $wp_rewrite->flush_rules(); ?

Mte90 commented 12 years ago

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /folder/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /folder/index.php [L] </IfModule> i get this in htaccess,

and the path it's /folder/css/*.css in the html that are not founded

kmlx commented 12 years ago

@Mte90 you should have many more lines in your htaccess. try permalink flushing.

Mte90 commented 12 years ago

i have the rest of htaccess rules of boilerplate but i think it's no needed to post here XD

yhristov commented 12 years ago

If you are using Wamp make sure that rewrite_module is enabled in apache.

Mte90 commented 12 years ago

i using apache on linux with mod_rewrite...

DrTrills commented 12 years ago

Im using Safari. Just cleared my cache and made sure my navigation was set to primary nav. Seems to be all good now.

onthehoods commented 12 years ago

I had this issue but once I'd changed the permissions on the .htaccess file in the website root to 755 everything worked fine.

artifacting commented 12 years ago

Unfortunately I'm having the same problem. I tried switching to and back from another theme. htaccess in both subdirectory and root set to 755 (also quickly tried 777 with no luck).

This is what the site looks like: http://www.artifacting.com/ and this is my .htaccess: http://pastebin.com/9b6QdBmt

artifacting commented 12 years ago

O.K. A little more additional info. I was able to fix this problem by setting both my WordPress Address (URL) and Site Address (URL) in the Settings -> General tab.

So it appears that if my wp is sitting in the www.artifacting.com/blog sudirectory I can't change the Site Address (URL) to http://www.artifacting.com/ and change the indexes location per the instructions here: http://askwpgirl.com/how-do-i-move-wordpress-from-a-subdirectory-to-the-root-directory/

Not sure if this helps pin down the bug or just expose another one, but I hope it helps.

retlehs commented 12 years ago

root relative URLs won't work with custom core file location installs (#54) so just disable support for those in config.php.

seems like this issue is filled with several different problems. this issue doesn't need to stay open since there's no proof of an actual bug.. see #395 for issues related to certain setups with subdirectory installs.

everybody else: make sure your .htaccess file is writable and contains the rules necessary for the rewrites to work. make sure your permalinks are flushed.

if you're still having issues you're probably missing something (check error logs, do some troubleshooting)

a typical roots .htaccess (without h5bp rules) should look like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^css/(.*) /wp-content/themes/roots/css/$1 [QSA,L]
RewriteRule ^js/(.*) /wp-content/themes/roots/js/$1 [QSA,L]
RewriteRule ^img/(.*) /wp-content/themes/roots/img/$1 [QSA,L]
RewriteRule ^plugins/(.*) /wp-content/plugins/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
Mte90 commented 12 years ago

how i can disable in config.php? this htaccess rules not work :-/