Change a php file path in Wordpress - wordpress

I am working on a wordpress plugin, I have an external php file that I need to use It should be placed in the Wp directory "http://localhost/forever/"
(where my wp files are uploaded).
For some reason I need to put this php file in an other folder but it should act like it's in Wp directory like changing its real path.

Related

How can I ignore folder name in wordpress?

I have a local wordpress website on IP "192.168.0.115".
There is a page in it called "Invoice" ("192.168.0.115/invoice").
I have about 800 PDF (invoice) files.
I would like their URL to be "192.168.0.115/invoice/invoice001.pdf", "...002.pdf" and so on.
What I did:
I made a folder called "invoice" in the htdocs folder next to "wp-admin", "wp-content" and "wp-includes" where I put all 800 PDF files.
It worked out - when I entered the URL "192.168.0.115/invoice/invoice001.pdf" it opened the desired PDF file.
But when I entered the url "192.168.0.115/invoice" I had no longer access to the page "Invoice".
Instead I got all of the files listed as in a folder through the browser.
I couldn't access the page, because of the same folder name and same page name -> "invoice".
My question:
Is there any way I can tell wordpress to ignore the folder called "invoice" and load the page with URL "192.168.0.115/invoice" AND in the same time open files with URL "192.168.0.115/invoice/invoice001.pdf"?
If you are using apache you can add a rewrite rule to your .htaccess file.
You can't have a WordPress page and a folder named that same thing. So the first thing you need to do is change your folder name from invoice to my-invoices. Then you add this rule to your .htaccess file:
RewriteRule ^invoice/(.*).pdf$ my-invoices/$1.pdf
Don't forget to rename your folder, but leave your WordPress page slug.
Then you'll be able to go to each of these URLs:
http://192.168.0.115/invoice/
http://192.168.0.115/invoice/invoice001.pdf
Be sure to place your new rewrite rule above the ones for WordPress.

Wordpress - allow files in site root to be accessed

I have a wordress site but I have a simple page which is not part of the wordpress project
http://sitetest.com/mypage.php
How can I make wordpress ignore this file and allow it to be shown
Just upload this php file to your /public_html directory and run as usually http://sitetest.com/mypage.php, it should work.
UPD. I checked and it works for me.
Just put the file in the site root folder. It will be accessible.
Example: if your site root is /var/www/html/ or public_html then put the file in html/public_html folder where others WordPress files & folders are like wp-content, wp-includes, wp-admin etc.

hosting webapplication on wordpress website

i have WordPress installed in the root http://ibdaa.info
what a need to do is to make sub-directory likee: http://ibdaa.info/app and upload my website to this sub-directory its contain (html,css,js)
i make try to just upload my site to previous link but it seem doesn't work
You will have to upload all the files present in the root folder of http://ibdaa.info to http://ibdaa.info/app and then change the site_url and the wordpress_url from the backend to the new url which in case is http://ibdaa.info/app and you will have to change the new url to point to the /app directory in the .htaccess file also.
A similar way would be to define constants in the wp-config.php file with the new url's
define('WP_HOME','http://ibdaa.info/app');
define('WP_SITEURL','http://ibdaa.info/app');

Locating local directory for localhost

I've been spending hours trying to locate where localhost's files are stored.
I've tried looking at the page source but all it tells me is http:/localhost/....
which is not what I need.
My Xampp directory (where I load Xampp control) is located in my desktop but there is no change when I alter stuff inside its htdocs.
The default root for XAMPP, assuming you installed in the default location, is c:\xampp\htdocs. You can change this by modifying the Apache configuration in c:\xampp\apache\conf\httpd.conf.
You can always check it through PHP:
echo $_SERVER["DOCUMENT_ROOT"];
Or if you want to use WordPress functions:
echo get_stylesheet_directory();
Include these codes in your page.php or header.php for example.

Unable to upload new theme to wordpress from dashboard

I installed wp to a server for the first time. The basic theme works and I can change the settings but I bought a new wordpress theme and was trying to upload it from the dashboard:
But it gives me an error each time:
These were suggestions I found online but didn't work:
So I tried to change the permissions of all of the folders to 755. And then I changed the permissions of the file update.php to 755 also but I still get the same error. I also tried editing the .htaccess of the folder 'AALimo' (folder which contains the wp dir) but that didn't work either. I'm not sure if I edited the .htaccess properly.
I just manually uploaded the theme into the theme directory using ftp instead of the theme uploader from dashboard and that worked.
I did it using C-Panel. I had to upload zip file in WordPress theme folder in public html. extract the zip file and you can install it easily .

Resources