WordPress page is also a directory - php

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

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!!)

Change home page to blog.php and add another home page

I have a WordPress installation on my website. Now I need to create a landing page (not WordPress) and, at the same time, maintain the WordPress installation on the same folder and still being able to access it with a different URL (e.g. www.mysite.com/blog.php instead of www.mysite.com).
So, to sum up:
index.php should be changed to blog.php
In this way, I can add a landing page (index.html) to my website
When accessing the website I should see the landing page (index.html), but still be able to see WordPress at www.mysite.com/blog.php (so, maintaining also the old permalinks to the blog)
I guess I should be changing the .htaccess file and maybe the settings of the blog, but I'm not able to find anything on the web (probably, I don't know what to look for).
By default server show index.html file first. you should not create a blog.php page. if in a directory has two files index.html and index.php you will see index.html when you visit your site.
just create an index.html page it will automatically show at first.
and if it not works .. just backup your .htaccess and delete it until you are working on developing.
That's it.

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.

Change Wordpress Admin URL For The Core Function

Can I check if there is a way to force a URL for certain functionality in the wordpress admin panel? The problem is, some functionality starts to break as it points to the wrong url ( points to the root domain)
The URL of wordpress is www.domain.com/subdirectory/ but the files are in the root directory (configures reverse proxy)
Some functionality like search post and log in starts to break (redirected to error 404 page in the root directory - e.g point to domain.com/wp-admin when it should be domain.com/app/wp-admin). it look up for www.domain.com instead of www.domain.com/subdirectory/
Note that in the database, I have already change the database site url to www.domain.com/subdirectory.

Using self hosted Wordpress with a 301 redirect

Recently I've been working to develop a multi-user Wordpress site with Wordpress 3.0 however at the moment we are iso.g one server to showcase preview static content in a subdirectory while multi WP is in the root directory.
My question however is how to keep the root directory hidden from the publc. Curntly I have a PHP index file handling he redirect howevwer as WP has its own index file I waned to ask about any possible alternatives.
Thanks very much for any assistance,
You're probably going to want to do it with an .htaccess file. However, Wordpress has one of those too, so rename the current .htaccess file to .htaccess.orig (or whatever you want... but don't delete it) and then create your new .htaccess file with your 301 redirect.
Then whenever you are done, just rename everything back to the way it was.

Categories