I need to use wordpress/woocommerce functions on codeigniter. I've tried the Woocommerce Rest Api and it is extremely slow. So for an alternative i've copied wordpress/woocommerce to codeigniter upload folder. In the index.php in codeigniter i've added
require_once('/home/sites/example.co.uk/public_html/retail/uploads/wordpress/wp-load.php');
require_once('/home/sites/example.co.uk/public_html/retail/uploads/wordpress/wp-blog-header.php');
Which is fine, i can now use wordpress functions but my codeigniter urls have been changed. I've removed the .htaccess from the Wordpress folder and urls are still changed. How do i solve?
I solved this by changing the site_url to wp_site_url in the wordpress folder. Now the urls in codeigniter aren't being changed.
Related
I was cleaning my hacked WordPress website and I found unusual code in index.php.
Is this the code used to hack my website? Or does it come from a plugin?
Your site is hacked.
I would use wp migrate DB to make a copy of the database, reinstall a fresh version of wordpress and all your plugins.
Is it possible to disable wordpress from a sub-directory?
Wordpress is currently installed in root.
So using wordpress' own CMS-functionality by going to Settings->General and changing Site-adress-URL wouldn't accomplish that since it would just move wordpress into a subdirectory. (which pretty much is the opposite of what i want to accomplish).
Is there any way to make wordpress ignore a specific subdirectory. Eg. Uploads/ to make me create standalone code there?
By default this should just work. The .htaccess file has a rule to ignore existing folders and files from rewrites. Creating a folder next to wordPress with custom code should work.
I've updated the main page for my site (http://www.goldfinchnj.com) to show the most recent posts from a wordpress site (http://www.goldfinchnj.com/news) The main page is mostly HTML, but I had to make it a .php file so it would pull in the 3 most recent posts.
The problem is all the pages & posts on the wordpress site seem to be using the index.php file from the root directory (the index for the main page).
Before this issue started, I changed the directory of the wordpress install. It was news.goldfinchnj.com, but I wanted it to be goldfinch.com/news.
Any ideas how to fix this?
How have you changed the directory? Have you updated all links in the database? Manually or you used search and replace plugin? Do you host wp on apache server? Do you have correct index.php in news subfolder and correct .htaccess?
Fixed it. Took another look at the .htaccess and had to update the path for the IfModule mod_rewrite.c
How can I upload a folder like a regular site and place it within a Wordpress folder but not have wordpress override the URLs for that particular folder.
Thanks
Your question is not really how you can do this, but why do it?
WordPress is overriding your URLs because of its own permalinks and rewrite rules in the .htaccess that handles the folder Wordpress is installed in and all subdirectories. Read https://codex.wordpress.org/htaccess
In order to place a "regular" site within a WordPress folder, you're going to have to work out some complex regex expressions https://stackoverflow.com/questions/tagged/regex and integrate them into Wordpress's own rewrite rules so both sites work. And then, when you change WordPress's own permalinks from admin and WordPress writes changes to .htaccess https://stackoverflow.com/questions/tagged/.htaccess, your own custom rules won't function anymore.
Directories below a directory with an .htaccess file will inherit those rewrite directives, so you can "negate" rewrite rules by putting a blank .htaccess file - or one with your own rules in it - in that folder. And this directory inheriting method is further controlled by server directives, if you have access to Apache httpd; which you won't, unless you're running your own server.
Again, why make things so complex? If you're going to use WordPress, integrate your content and site into WordPress. It is straightforward to integrate your own PHP and MySQL data into a WordPress site through the use of page templates. If you want a plain PHP/MySQL site in the same hosting area as WordPress, keep it separate.
I am trying to merge my custom made directory site together with my wordpress site in one domain.
There seems to be issues with the url being redirected to my wordpress categories. How can i rewrite url in wordpress to compliment my directory site.
I don't think it's possible. Category, tag, page, post etc. slugs could collide with your directory names. You would have to either create a filter for WP to redirect specific URLs to your old content or modify your .htaccess file. Both methods are extremely complicated if you have a lot of pages, and overkill if you have only a few.
Why not migrate your old content to WP? Or if you don't want to do that, install WP into a subdirectory of your site, like /blog.