hi all i am purely newbie to right .htaccess files. The issue is,
My base directory is http://localhost/mvctask/and i want to use the files of sub directory sub.
for example:
http://localhost/mvctask/ will be using http://localhost/mvctask/sub/login.php instead http://localhost/mvctask/login.php.
While url remain same as http://localhost/mvctask/. I need it to do without using rewrite-rules.
Please any help.
Edit:
I changed the index.php to login.php in edit. just because there is option to use DirectoryIndex mysubdir/index.php to change index .
I find the solution that same DirectoryIndex is working for all files. While previously i assumed that it works only for index files (may be i confused due to it's name :P ).
DirectoryIndex mysubdir/login.php
Related
http://localhost/laravel_test/
Instead of routing to the index.php above URL is only printing Index (Directory Structure) of /laravel_test.
I am able access the index page with following:
http://localhost/laravel_test/public/index.php
I tried modifying the .htacess file by adding following line inside the public directory of laravel_test still no change:
DirectoryIndex index.php
This is an old post, but in case this helps anyone, I was facing this problem because my httpd-vhosts.conf file was pointing to C:/xampp/htdocs/MySite instead of C:/xampp/htdocs/MySite/public. This is stupid mistake but you know everyone does this kind of mistakes once in a while.
Sorry if this is a basic question, but Im wondering why my site doesn't display correctly unless I utilize the index.php extension. Here is an example :
www.copishboutqiue.com/salon
which displays incorrectly but
www.copishboutique.com/salon/index.php displays the correct layout we're using. Why do I need to use the index.php when this is the only file in the root directory?
if you are using an apache server create a .htaccess file in the root directory of your website and add
DirectoryIndex index.php
I had a index.html page and index.php file are in the same folder .My folder name is Tester and also i had the sub domain with the same name. i am using the following URL www.Tester.hoster.com/ . My issue is, if i use the above link it directly show the .php file. how i display the .html page instead of .php page plz guide me thanks in advance
DirectoryIndex index.html
Add this in your .htaccess file
This is something that you need to update on your server. Depending on if you're using Windows ( IIS configurations should handle this ) or Linux (.htaccess should handle this)
.htaccess:
DirectoryIndex index.html
You can also add more file names/extensions after index.html, they will be treated by priority in the order in which you list them.
Not sure about ISS, sorry.
There are several ways to do it, URL Rewrite being a smart option.
A quick technique is to change the name of the index.php file to something else, say home.php.
I have a small little site I am testing, first time using PHP. It is sitting on an Ubuntu box, in the /var/www folder. I can get to it in my internal network, but I can't get to it outside. I have port 80 forwarded to my Ubuntu box in my router. That is the first question. Second, how do I designate the first page to be served when you get to that box. The default Apache page is index.html. I want a page called login.php to be first. I have renamed index.html to html.old, but then I just get a file listing. Any help, much appreciated.
For custom index page place this in your .htaccess (in root folder)
DirectoryIndex login.php
I don't understand your first question.
For the apache default page, you can either go find your httpd.conf file edit this:
DirectoryIndex index.html
Or you can add the following to a .htaccess file:
DirectoryIndex login.php
2) Delete or move index.html. Rename login.php to index.php or create a new index.php with
<?php require dirname(__FILE__) . '/login.php';
Thats the most basic ways to do this. There are many there solutions, but it seems to me, that this is sufficient in your case.
This works, because the apache by default is looking for several index.*-files (in order).
It's been a while since I created a new directory on my domain (call it my/domain/dir3). I have others, each containing a index.php (dir1/index.php - dir2/index.php), each index is called if the directory URL is called (thus a URL of my/domain/dir1 will call my/domain/dir1.index.php).
No the embarrasing part ... I've completely forgotten how I did this! ... blank .... nothing ... no recollection. Please somebody enlighten me.
If you use Apache, it does this automatically. You can tweak the settings in httpd.conf though.
Well if it's a standard Apache/PHP installation then putting an index.php file in the directory would make it the default page in a directory.
Oh, if you want a different file to be the index. Create a .htaccess file in the directory and enter this:
DirectoryIndex index.html index.htm index.php something.php
Replace something.php with the file you want and presto ;). You can't have two indexes.
If index.php is seen by Apache as the default index file, my/domain/dir1/ will see my/domain/dir1/index.php. If you want something more complex, You'll need mod_rewrite.