Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-14-2010, 04:34 PM   #1
Si
Such Fun!
 
Industry Role:
Join Date: Feb 2008
Posts: 13,900
Scripting / wp / .htaccess kinda question [help!]

Hey all.

I've never had this problem before, but I'm sure it's something simple.

Right so first things first. I'm trying to include a piece of java script into wordpress.

Code:
    <script type="text/javascript" src="http://domain.com/wp-content/plugins/pluginfolder"></script>
But, it appears because I have permlinks set on ( /&postname%/ ) That it will not load up what I want it to.

What is the way round this?

I'm guessing it's something simple but never had to do it before.

Thanks for any suggestions
Si is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 04:36 PM   #2
Si
Such Fun!
 
Industry Role:
Join Date: Feb 2008
Posts: 13,900
So basically all I get when trying to access the script, is a 404 error because it is trying to find a post or page.
Si is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 04:47 PM   #3
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,110
Quote:
Originally Posted by Si View Post
So basically all I get when trying to access the script, is a 404 error because it is trying to find a post or page.
If what you have in there is domain.com/wp-content/plugins/pluginfolder then it looks like you are trying to open a folder, not a file, unless the name of the file that has your script in it is actually pluginfolder without any extension.

Usually your source comes from a file:

domain.com/wp-content/plugins/pluginfolder/myjavascript.js

Or some such.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 04:58 PM   #4
Si
Such Fun!
 
Industry Role:
Join Date: Feb 2008
Posts: 13,900
Quote:
Originally Posted by sarettah View Post
If what you have in there is domain.com/wp-content/plugins/pluginfolder then it looks like you are trying to open a folder, not a file, unless the name of the file that has your script in it is actually pluginfolder without any extension.

Usually your source comes from a file:

domain.com/wp-content/plugins/pluginfolder/myjavascript.js

Or some such.
I thought it would have loaded fine aswell but it's not working which is weird!
Si is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 05:23 PM   #5
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,110
Quote:
Originally Posted by Si View Post
I thought it would have loaded fine aswell but it's not working which is weird!
so domain.com/wp-content/plugins/pluginfolder is the name of a file? Not a folder?
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 05:24 PM   #6
CPimp
Confirmed User
 
CPimp's Avatar
 
Industry Role:
Join Date: Aug 2009
Posts: 2,346
yeah if you're trying to include a javascript, you'd have to include the actual file, not folder. Hit me and I can help real quick before I leave.
__________________
three 997 three 55 three 1 ← That's my ICQ. Contact me there. Thanks.
CPimp is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 05:25 PM   #7
Si
Such Fun!
 
Industry Role:
Join Date: Feb 2008
Posts: 13,900
So is there not a rewrite rule, or exclude I do to stop it?

Or give an exception to a certain page etc... ?
Si is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 05:27 PM   #8
harvey
Confirmed User
 
harvey's Avatar
 
Industry Role:
Join Date: Jul 2001
Location: 127.0.0.1
Posts: 9,266
double check your path and be sure to include the filename, this has nothing to do with .htaccess or permalinks, as long as your absolute URI path is correct, you shouldn't get a 404. I'd understand some javascript not working because it's the wrong order (ie you need to call jquery or any other library first and then the script), but it shouldn't give you a 404, so chances are you have the wrong path
__________________
This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth
harvey is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 05:28 PM   #9
Si
Such Fun!
 
Industry Role:
Join Date: Feb 2008
Posts: 13,900
Quote:
Originally Posted by tube2k View Post
yeah if you're trying to include a javascript, you'd have to include the actual file, not folder. Hit me and I can help real quick before I leave.
It's ok I have got it working by putting it onto a subdomain.

I was doing the file (made a mistake above) e.g.: /path/folder/file.js

Would be nice to know a rule for .htaccess to stop it from rewriting a path though if anybody knows how to do it?
Si is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 05:32 PM   #10
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,110
Quote:
Originally Posted by Si View Post
It's ok I have got it working by putting it onto a subdomain.

I was doing the file (made a mistake above) e.g.: /path/folder/file.js

Would be nice to know a rule for .htaccess to stop it from rewriting a path though if anybody knows how to do it?
Where was it rewriting a path? If you call a folder using http:// then apache will look for index.html, index.htm, default.html, index.php (whichever flavor your settings indicate) in the folder you pointed to.

Since it looks from here like you were calling a folder then my guess is apache did not find the folder or if the folder existed it did not find a default page so then it went 404.
__________________
All cookies cleared!
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 05:33 PM   #11
Si
Such Fun!
 
Industry Role:
Join Date: Feb 2008
Posts: 13,900
Quote:
Originally Posted by harvey View Post
double check your path and be sure to include the filename, this has nothing to do with .htaccess or permalinks, as long as your absolute URI path is correct, you shouldn't get a 404. I'd understand some javascript not working because it's the wrong order (ie you need to call jquery or any other library first and then the script), but it shouldn't give you a 404, so chances are you have the wrong path
Yeah, thats what I done. It don't make sense giving out a 404. I done both ways aswell.

http://domain.com/wp-includes/plugin...folder/file.js

and

/wp-include/filefolder/file.js

And neither of them worked. So I put the file onto a subdomain and it's now working.
Si is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 05:34 PM   #12
harvey
Confirmed User
 
harvey's Avatar
 
Industry Role:
Join Date: Jul 2001
Location: 127.0.0.1
Posts: 9,266
Quote:
Originally Posted by Si View Post
It's ok I have got it working by putting it onto a subdomain.

I was doing the file (made a mistake above) e.g.: /path/folder/file.js

Would be nice to know a rule for .htaccess to stop it from rewriting a path though if anybody knows how to do it?
again, it has nothing to do with wordpress nor htaccess, it was something you did.

If you used /path/folder/file.js you'll ALWAYS get a 404. You need to use php bloginfo('template_directory') to locate the file, like the example below:

Code:
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/my_js_file.js"></script>
__________________
This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth

Last edited by harvey; 02-14-2010 at 05:37 PM..
harvey is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 05:41 PM   #13
Si
Such Fun!
 
Industry Role:
Join Date: Feb 2008
Posts: 13,900
Ok before I confuse you all let me start again and try and be more clear

I used the following code:

Code:
    <script type="text/javascript" src="http://domain.com/wp-includes/plugins/filefolder/file.js"></script>
So it should have been calling the file directly.

But it wasn't working, so I type in the full path as above, and it went to a 404 error page. "SORRY, WHAT YOU ARE LOOKING FOR ISN'T THERE"

So I then tried using the following code:

Code:
    <script type="text/javascript" src="/wp-includes/plugins/folder/file.js"></script>
And still nothing.

Now I have put it onto scripts.domain.com and put the files into the root and used this code

Code:
    <script type="text/javascript" src="http://scripts.domain.com/file.js"></script>
And it works!

But if it was giving out a 404 error for the path, wordpress and/or my .htaccess must have been re-writing the path right?
Si is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 05:44 PM   #14
Si
Such Fun!
 
Industry Role:
Join Date: Feb 2008
Posts: 13,900
Quote:
Originally Posted by harvey View Post
again, it has nothing to do with wordpress nor htaccess, it was something you did.

If you used /path/folder/file.js you'll ALWAYS get a 404. You need to use php bloginfo('template_directory') to locate the file, like the example below:

Code:
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/my_js_file.js"></script>
Got ya! thats why it wasn't calling it up properly. I will give that a shot and see what happens
Si is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 05:51 PM   #15
harvey
Confirmed User
 
harvey's Avatar
 
Industry Role:
Join Date: Jul 2001
Location: 127.0.0.1
Posts: 9,266
Quote:
Originally Posted by Si View Post
Got ya! thats why it wasn't calling it up properly. I will give that a shot and see what happens
btw, are you sure your absolute path isn't wp-content instead of wp-includes?
__________________
This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth
harvey is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-14-2010, 06:31 PM   #16
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,372
always use blog info
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.