We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

first load index.html then index.php (oxwall) | Forum

Topic location: Forum home » Support » General Questions
TimoViBritannia
TimoViBritannia May 31 '14
hello,
is it possible to use the htaccess file to first load the index.html and then the index.php to make a welcome page with the index.html?
The Forum post is edited by TimoViBritannia May 31 '14
John
John May 31 '14
To my knowledge a browser looks for the Index file in a folder to open the script or page. Thus you should never have two index files in the same folder. if you do, the browser won't know which one to open. There may be a pecking order (php index files are opened first if there's a conflict) but I've never tried.

You'll have to name one of the folders differently such as index2.html and maybe you can then use htaccess to access that file first. I thought the easiest way to do it would be through a redirect. You should be able to tell the server to redirect a user to http://mysite.com/index2.html, then you can have a link from that page to Oxwall's Index.php.

That's usually done through cPanel.
Pete
Pete May 31 '14

By default servers will look for (in order) a file by the name of index.html, index.cgi, index.php, index.htm, default.htm or home.htm in a given directory and will load the first file it finds as the directory's (or site's) index or "home" page. If you wish to use an alternate file name as a default index page this can be done by adding the following directive to a .htaccess file stored either in your public_html directory (if you wish the directive to be in effect for your your entire site) or in a specific folder:

DirectoryIndex filename.ext

For example if you wish the default index page in a given directory to be "default.php" you would place a .htaccess file in that folder containing the following line:

DirectoryIndex default.php

Things to Note

You can specify multiple file names and the server will look for them in the order you specify and set the first valid file name found as the directory's index page. If you intend on setting a non-standard index page as your site's main index page you'll likely want to include more standard index file names along with your custom name so that you will be able to use standard index files such as index.html or index.php in subdirectories without having to add separate .htaccess files.


With the directive above in place the server will first look for a file named "page1.html" and if found will load it as the directory index. If no file by that name exists in a given directory it will look for (in order) files named index.html, index.php and index.htm and load the first file it finds as the index page.

The Forum post is edited by Pete May 31 '14
TimoViBritannia
TimoViBritannia May 31 '14
yes i already tried (DirectoryIndex index.html) this but it isn't working. The normal oxwall side is being loaded :(

here is my .htaccess file

DirectoryIndex index.html index.php

Options +FollowSymLinks
RewriteEngine On

AddEncoding gzip .gz
AddEncoding gzip .gzip
<FilesMatch "\.(js.gz|js.gzip)$">
  ForceType text/javascript
</FilesMatch>
<FilesMatch "\.(css.gz|css.gzip)$">
  ForceType text/css
</FilesMatch>


RewriteCond %{REQUEST_URI} !/index\.html
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} !/ow_updates/index\.php
RewriteCond %{REQUEST_URI} !/ow_updates/
RewriteCond %{REQUEST_URI} !/ow_cron/run\.php
RewriteCond %{REQUEST_URI} (/|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php

Pete
Pete May 31 '14
you could try renaming your index file ,that may work
ross Team
ross Jun 2 '14
Timo make sure there's no other .htaccess files a level above which may conflict with this rule. 
TimoViBritannia
TimoViBritannia Jun 2 '14
Sorry Ross what Do you mean?
ross Team
ross Jun 2 '14
I mean the directory/folder/files tree
TimoViBritannia
TimoViBritannia Jun 2 '14
I have one in the ow_plugins folder and some more sub folders of the oxwall installation
ross Team
ross Jun 4 '14

RewriteCond %{REQUEST_URI} ^/$

RewriteRule (.*) index.html [L]


you need to paste it one line above our default conditions

if you software is in the subfolder: 


RewriteCond %{REQUEST_URI} ^/subfoler/$

RewriteRule (.*) index.html [L]

The Forum post is edited by ross Jun 4 '14
JB TECH
JB TECH Jun 4 '14
You can also try just making a change to the directories, though it will require some changes to main code in Oxwall unless you just re-install. For example;


In the main public_html of your website, add you index.html or index.php file (your welcome page) and anything else like it's styles, about pages, etc. Then add another folder, for example named 'oxwall' or 'home' where Oxwall will be installed. You now have your own custom welcome page, plus Oxwall.


With some code modifications, you could even manage to load the sign-in / sign-up options of Oxwall onto your welcome page.


~Jake

ross Team
ross Jun 4 '14
Timo please let us know when you try the solution, if it works for you, so I could mark the topic as solved. 
JoshWho
JoshWho Jul 11 '15

Quote from ross

RewriteCond %{REQUEST_URI} ^/$

RewriteRule (.*) index.html [L]


you need to paste it one line above our default conditions

if you software is in the subfolder: 


RewriteCond %{REQUEST_URI} ^/subfoler/$

RewriteRule (.*) index.html [L]

When i add that line it just loops the html page.


Can you show a working example to allow a .html load first

tammy harris
tammy harris Jul 11 '15
i think in custom code modes i read a post that daisy answered long time ago on how make a landing page thats separate from oxwall 

JoshWho
JoshWho Jul 13 '15
Im not understanding.


I add this line 

RewriteCond %{REQUEST_URI} ^/$

RewriteRule (.*) index.html [L]


above 


RewriteCond %{REQUEST_URI} !^/index\.php

RewriteCond %{REQUEST_URI} !/ow_updates/index\.php

RewriteCond %{REQUEST_URI} !/ow_updates/

RewriteCond %{REQUEST_URI} !/ow_cron/run\.php

RewriteCond %{REQUEST_URI} !/e500\.php



so looks like this


RewriteCond %{REQUEST_URI} ^/$

RewriteRule (.*) index.html [L]

RewriteCond %{REQUEST_URI} !^/index\.php

RewriteCond %{REQUEST_URI} !/ow_updates/index\.php

RewriteCond %{REQUEST_URI} !/ow_updates/

RewriteCond %{REQUEST_URI} !/ow_cron/run\.php

RewriteCond %{REQUEST_URI} !/e500\.php

The Forum post is edited by JoshWho Jul 13 '15
ross Team
ross Jul 13 '15
Josh, if I understood your correctly you want to load first some.html file then index.php


The solution above lets you to load index.html file if you go to www.yoursite.com/index.html


However, if you want to do something like splash screen, it is not possible to do via .htaccess file, as it uses session to remember whether a user already saw it or not


There's a solution to load index.html file instead of index.php but it will load it everytime a user goes to index page. 


You will need to create a plugin in order to achieve what you want. 



JoshWho
JoshWho Jul 13 '15
is there a crash course for how to make a custom html page blank plugin?


A page that oxwall doesn't interfere with that I can add any html code and my own meta tags to.

The Forum post is edited by JoshWho Jul 13 '15
ross Team
ross Jul 13 '15
No, there's no such course. 
JoshWho
JoshWho Jul 13 '15
:(         I have so much to figure out still. 
Pages: 1 2 »