Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7517661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:31:25+00:00 2026-05-30T01:31:25+00:00

I have a website, say http://mysite.com . I would like to put index.php in

  • 0

I have a website, say http://mysite.com. I would like to put index.php in a subdirectory, public_html/mysubdir/index.php. I would like public_html/mysubdir/index.php to get executed when the user goes to http://mysite.com. And I would like the url to continue to read http://mysite.com. Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:31:28+00:00Added an answer on May 30, 2026 at 1:31 am

    Rewrite rules may be overkill for this depending on what you want. For just your main index page, this will work…

    Simply adding this one line to your .htaccess file:

    DirectoryIndex mysubdir/index.php
    

    It will display the page located at mysubdir/index.php while simply showing http://mysite.com in the URL.

    I use this method myself. While all of my pages are located in the same subdirectory, the home page is displayed with my domain name by itself (http://www.mysite.com). All other pages show the full URL.


    If you also have index pages within deeper subdirectories and want those to come up by default within the subdirectory.

    Example:

    If you want this page: http://mysite.com/mysubdir/anothersub/index.php

    to come up with this URL: http://mysite.com/mysubdir/anothersub/

    Then modify the line with another index.php like this…

    DirectoryIndex mysubdir/index.php index.php
    

    What this does is tell the server to look for files with those names in that same order. If it can’t find the first, it tries the second, and so on.

    When you’re inside your root at / it finds and then displays mysubdir/index.php.

    When you’re inside another subdirectory like /mysubdir/anothersub/, it can’t find anything named mysubdir/index.php so it goes to the next item and displays index.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say i have a form <form action=delete_post.php method=post>...</form> on my website: http://mysite.com and
Suppose I have a website hosted at the url: http://www.mysite.com/ Say this is hosted
I have a website, lets say: http://www.example.com/ I'm using rewrite module, but I have
I have a url such as the example below http://www.website.com/page.php?pid=263547322425&foo=too How can i use
Say I have the website http://www.example.org and the corresponding Facebook page at http://www.facebook.com/example .
I have a website I want to regexp on, say http://www.ru.wikipedia.org/wiki/perl . The site
I have two websites: http://example.com http://example.com/sub I have a page, let's say: http://example.com/sub/page1 Is
I have 1 blog say xyz.blogspot.com ,now am uploading my own website,so I want
I have a website say www.livesite.com which is currently running. I have been developing
I have a website say www.mywebsite.com/demo . When ever if anyone requests this site,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.