Cookie Free Domain Doesn't work - wordpress

I was following this tutorial: http://www.xpertdeveloper.com/2011/07/wordpress-cookie-free-domain/
So, I created (CPANEL) the subdomain static.artswr.com and redirected it to artswr.com/wp-content/
I edited and add the following in the end of the wp-config file:
define("WP_CONTENT_URL", "http://static.artswr.com");
define("COOKIE_DOMAIN", "www.artswr.com");
I am loading everything with <?php bloginfo('template_directory'); ?> but its not working, also I'm getting 404 errors when I try to find a file in static.artswr.com

Instead of
define("WP_CONTENT_URL", "http://static.artswr.com");
Try
define("WP_CONTENT_URL", "http://static.artswr.com/wp-content");
without any redirections from your cpanel. static.artswr.com should point to artswr.com

check below line:
So, I created (CPANEL) the subdomain static.artswr.com and redirected it to artswr.com/wp-content/
You mentioned that you have redirected, but it should not be redirect, It should map to wp-content folder.
Let me know if any comments.

Related

Unable to get to wp-admin log in page

Hi I have recently tried to log in to my site and I keep getting the following error:
Warning: Cannot modify header information - headers already sent by
(output started at
/homepages/6/d700752663/htdocs/clickandbuilds/OnyxMotorsCompany/wp-content/themes/cardealer/includes/base_functions.php:1)
in
/homepages/6/d700752663/htdocs/clickandbuilds/OnyxMotorsCompany/wp-includes/pluggable.php
on line 1210
I have not made any changes to website. The website itself works fine however I cannot get to wordpress dashboard either via wp-login and wp-admin.
Any idea? Thank you
Open base_functions.php & try and add following code on top.
<?php ob_start(); ?>
You have already marked path to file: /homepages/6/d700752663/htdocs/clickandbuilds/OnyxMotorsCompany/wp-content/themes/cardealer/includes/base_functions.php
I hope it will help.

Wordpress Multisite SubSites: 302 Moved Temporarily

I've recently changed the domain for Multisite website, I followed the instructions from here https://wpengine.com/support/how-to-change-a-multi-site-primary-domain/
Now, only main site(http://domain.com/) works but the other sites (e.g: http://domain.com/es/) are giving error "302 Moved Temporarily" and redirected to itself (http://domain.com/es/).
Under Network Admin > Sites > Edit(for sub site i.e: http://domain.com/es/) > Settings, Siteurl and Home is also same as the main URL rather than http://domain.com/es/. I tried to change it to http://domain.com/es/ but, opening the http://domain.com/es/ URL updates it back to http://domain.com/
in my wp-config.php file these lines are commented out
//define('WP_HOME','http://fruitionpartners.eu');
//define('WP_SITEURL','http://fruitionpartners.eu');
Is there something I am missing? Please help.

Unable to access analytics.txt once uploaded, returns 404

I've been asked to add an analytics.txt file to a wordpress website so I've created the file and uploaded it to the server document root but when I go to it via the url www.examples.com/analytics.txt all I get is a 404 error.
I've checked the file permissions and I've cleared the wordpress cache but neither have helped.
Any ideas?
The folder structure is as follows:
wp-admin
wp-content
wp-includes
analytics.txt <-- added this file, but cannot seem to access it via a web browser
index.php
etc...
This is NOT the solution but it is a work-around while I carry on trying to figure out why wordpress won't allow me to access my file.
So if you're desperate and HAVE to get it sorted right now, here is what you could do, but I warn you, it's ugly! Open your index.php file and you should see something like this:
<?php
define('WP_USE_THEMES', true);
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
?>
Make a backup copy first and then add the wrapping if statement:
<?php
if ($_SERVER[REQUEST_URI] == '/analytics.txt') {
die('Put the text that you were instructed to put into your analytics.txt file in here');
} else {
define('WP_USE_THEMES', true);
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
}
?>
Like I said, this is a dirty solution but when needs must and the client is getting impatient, this could help in the mean time.
Hoping that someone will have a better solution though!
I was able to get this to work with the following for the Sage theme:
Upload the analytics.txt through the theme administration panel
Copy the url of the upload and remove the hostname. For me it looked like this: app/uploads/2018/09/analytics.txt
Open the functions.php file and add the following:
function analytics_txt_rewrite(){
add_rewrite_rule('^analytics\.txt$','<route to your analytics.txt file>','top');
}
add_action('init','analytics_txt_rewrite');
Flush and regenerate the rewrite rules database: From WordPress Administration Screens, Select Settings -> Permalinks and just click Save Changes without any changes.

Wordpress - Get root directory?

How can I get the root directory of my site? I want to use it as the src for <img>.
For example If I install the wordpress on www.mysite.com/blog/, the root is /blog.
But If I install it to www.mysite.com/test/blog, the root is /test/blog.
I tried to use the snippet from this question, but it returns the whole path as seen in FTP. So instead of returning just /blog, it returns /home/public_html/blog which won't work if used as src in image tag.
Any solution? Thanks.
You may use site_url() (eventually with echo) to get absolute path with server name and directory. Also, have a look at wordpress documentation about similar functions & what they provide.
You may have better luck over at the Wordpress Stack Exchange site :)
And this suggestion to use ABSPATH didn't help on that thread? https://stackoverflow.com/a/2356467/413254
site_url() return the path with http, in some cases, it is not allowed if the server turns off url inclusion. You can use the function below to get the root path of wordpress installation folder:
function get_wp_installation()
{
$full_path = getcwd();
$ar = explode("wp-", $full_path);
return $ar[0];
}

wp_redirect works on localhost but conflicts not on my host

I'm having a weird problem, I have the following code in my page.php template file:
if (is_page('redirect')) :
wp_redirect( get_option('home') );
else:
//Do something else
endif;
This works fine on my localhost, but when I upload it to my server it gives me the Headers already sent by pluggable.php, I understand there must be no output before calling this function but there isn't! Also I disabled my only plugin installed (buddypress) and nothing, there must be something on my host because otherwise it woudln't work on my localhost either.
Does anyone know what could be wrong??
Thanks in advance
Nvm, for some reason I updated WP to 3.1 and it fixed.

Resources