redirecting url (PHP server)

I have a link like this:

http://www.myurl.com/function/

What I want to do here is that whenever someone visits that link they will be redirected to:

http://www.myurl.com/index.php/function/

How can I do this?

Any url from function/ onwards should also be redirected:

from -> to

http://www.myurl.com/function/do.php -> http://www.myurl.com/index.php/function/do.php

http://www.myurl.com/function/index.html - > http://www.myurl.com/index.php/function/index.html
Bandai2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mmarx82Commented:
Use this:

<meta http-equiv="REFRESH" content="1"; url=http://www.the-domain-you-want-to-redirect-to.com">

Put the above between your Head tags. Content is the number of seconds before the redirect takes place, It's not a good idea to use 0 as some browsers do not support it.

0
V4nP3rs13Commented:
header("location: index.php/function/index.html");

or yot can use mod rewrite in htaccess
0
Bandai2Author Commented:
I read about mod rewrite i think its the solution i'm looking for... but it seems very complicated.. can you tell me how I can do this by using mod rewrite?
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Avinash ZalaWeb ExpertCommented:
use below htaccess rule:


RewriteRule ^function/([a-zA-Z]+).([a-zA-Z]+)$ index.php/function/$1.$2 [R=301,L]
RewriteRule ^function/([a-zA-Z]+).([a-zA-Z]+)/$ index.php/function/$1.$2 [R=301,L]

This will redirect permanent.

Hope this helps.
Addy
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bandai2Author Commented:
I tried it like this and it works:

Redirect /function http://myurl.com/index.php/function

what's the difference between this and the code given above? This is much simpler? but is the code above much better?
0
Avinash ZalaWeb ExpertCommented:
This is the url rewrite method with Apache rewrite module.

It is the standard method for redirecting the urls.


Hope this helps.
Addy
0
V4nP3rs13Commented:
Using mod rewrite is better than using redirect, because some of your website visitors may access your site via their bookmarks, so, he can access on old and new links. You have both.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.