Solved

rewrite address bar url to include index.php if not there

Posted on 2004-05-03
5
619 Views
Last Modified: 2013-11-18
lets say I have the following site
http://mysite.com/mydir/

I need a way do that is a user goes to mysite.com/mydir
they will be redirected to http://mysite.com/mydir/index.php.

I know index.php is the default, but I want this to be displayed in the address bar. can I use mod_rewrite, and if so how.

just to recap I want all valid combinations of urls to display http://mysite.com/mydir/index.php in the address bar. This includes mysite.com/mydir, mysite.com/mydir/index.php, http://mysite.com/mydir.

any help would be great
0
Comment
Question by:shainegordon
5 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10977938
Redirect /mysite/   http://www.mysite.com/index.php
0
 

Author Comment

by:shainegordon
ID: 10978958
I used php instead to check the $_SERVER['REQUEST_URI'] for the presense of index.php. if not found I echoed a javascript window.location=index.php

that was enough for my needs.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10979038
and how about browsers without JavaScript?

Also keep in mind that your browser still requested a file, otherwhise you could not have used php-code on the server.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 11785210
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:

    PAQ - refund

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Periwinkle
EE Cleanup Volunteer
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 11812618
PAQed, with points refunded (100)

modulo
Community Support Moderator
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Coova-Chilli can't work with URL using HTTPS! 3 275
Updating PHP in Windows Server 2012 r2 22 199
cookies analysis tools 2 100
Show tab when enter div and change underline color 3 63
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question