How to integrate wordpress with an existing php homepage? - php

I have already a site with a single homepage index.php which accepts 2 parameters like
http://mydomain.com/index.php?param1=something&param2=somethingelse
param2 can be optional
I want to install wordpress on the root directory, except for index.php and the above url, I want wordpress to show the blog pages.
How to do that either in PHP and/or htaccess ? (I'm very bad at htaccess so I prefer php).

You can follow this approach: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
and then merge the functionality of your existing index.php with Wordpress' index.php (your custom parameter handling etc). Or should your current index.php be completely different?

Related

Url redirection for custom post types - wordpress

So i have created a plugin that gets data from a API and creates posts. For example posts urls are similar to following structure .
https://sitesite.net/invite/username
About 100 posts are created this way and the only thing differs is the username. I want to redirect all
urls with /invite to a certain another url.
What is the best way to do this? Please consider that i'm new to wordpress.
So far i've tried some plugins like Redirection plugin and SEO Redirection Premium plugins. But i could not find a way to redirect all the urls with /invite in the url to another url. Both these plugins can set the source url and redirect to another url. But it's not practical for me as i have 100s of urls.
How can i redirect all my urls to another url .
The best way is to do it directly in your .htaccess file in the root folder of your Wordpress installation.
The following rewrite rule will redirect all pages in your invite folder to the same page in another folder called newfolder:
RewriteRule ^invite/(.*)$ /newfolder/$1 [R=302,NC,L]
Note the R=302 - make sure you use this for testing and only change it to a permanent 301 redirect when you are sure everything works!
(The .htaccess is not a Wordpress file, standard file on your web hosting. But if you’re not familiar with it, it’s a very important file to make your site work, so check back with us if you’re unsure of anything before you change it and always make a backup before ANY changes to it!!)

.htaccess for static php file

I had to add a PHP file within a Wordpress installation. I have created a subfolder and the file works fine, but I need to make it "pretty" according to Wordpress permalinks style.
In few words:
https://example.com/php/partners.php
must become https://example.com/our-partners/
How can I do it? Where should I place the .htaccess file? In the root as it is now or will I need another one in "php" folder?
Thank you!!!
Max
Easy way make wordpress template in theme.
Put below code at the top of the php file in comments
<?php /* Template Name: logicdigger */ ?>
Then move your file in to your theme.
Go to add page and create new page then select template from right side of your screen. THAT'S ALL
Complete article here
You will edit the existing .htaccess file in the root. Something like this should work:
RewriteEngine on
RewriteRule ^/?our-partners/?$ /php/partners.php
Requests to /our-partners and /our-partners/ (with or without trailing slash) will point to /php/partners.php. This also allows for query params in the URL if needed: /our-partners?foo=bar
This requires mod_rewrite to be enabled in apache. The docs for RewriteRule can be found here

WordPress page is also a directory

I've got a WordPress page where the permalink is /foo.
I'm hoping to add a new HTML page (non-WP) at /foo/bar, but when I created that folder via FTP, obviously the original /foo page started showing an empty directory, instead of the old WP page.
Is there any way of combining the two, so the index of /foo is the WordPress page and the index of /foo/bar is a non-WP HTML page?
Many thanks!
The HTTP request first resolve the folder which you placed inside your WordPress installation. So there is no direct way to achieve this becuase your sub-folder name is same as the page URL.
You need to rename your folder-name/page permalink to make this happen.
Here is some suggestions,
WP Page and Subdirectory with same name
Page URL not working due to physical directory
Also please ask WordPress related question here: WordPress Stack Exchange

Embedding WordPress into static site

I am trying to use wordpress in conjunction with my static site. The wordpress page will just be the gallery. I have wordpress installed in the root dir of my site to prevent an extra subfolder in the link (site.com/wp/page).
I am trying to my index page as the static on which isn't using wordpress so what I tried doing was changing the directoryindex file in the .htaccess but obviously didn't work because wordpress uses index.php to launch the wordpress environment.
Does anyone know any work around for this? It would be greatly appreciated.
Add this to your .htaccess file :
DirectoryIndex mynewindex.php
this will set your main directory index to be mynewindex.php so change it to what ever index page you want .
#GANIZ
Here is a way to help you achieve what you want. You can create a subdomain ex. gallery.example.com and point it to the new directory you have created in root dir.
This should make it publicly available. Then the simplest form of importing a page from the wordpress installation is with an HTML iframe . Also note that Wordpress requires a MYSQL database.

How can I change index.php to index1.php in joomla?

I want to change index.php to index1.php in joomla eg :
Now it is www.domain.com/index.php?option=com_content.....
I want change to :
www.domain.com/index1.php?option=com_content.........
In Joomla, index.php is the starting point for every single "page" that can be displayed by the CMS. Trying to change that would require extensive changes to the Joomla core. I would highly recommend not doing that, you will regret it. You have a couple of options -
Use index.html or maybe default.php for the other info you want. You can change the order that the web server uses the default file so that one of those comes up before index.php
Put Joomla in a subdirectory

Categories