/    Sign up×
Community /Pin to ProfileBookmark

How to do automatic redirection with PHP and in .htaccess?

Need help how to do index.php and it will stable redirect to anothe page when user goes on index.php.

How to solve this with PHP language and .htaccess?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@SheldonMay 08.2008 — Hey Toplisek, Good to see you back.

You want to redirect away from index.php automatically ?

You can do this in two ways as you have suggested;

with PHP
[code=php]<?php

header("Location: /this_page.php");
die;

?>[/code]


or two ways with the .htaccess file

1) Set Default Page
[code=php]DirectoryIndex this_page.php index.php index.html index.htm[/code]
This will look for those files in order, separated by a space

2) Permanent Redirect
[code=php]Redirect permanent /index.php /this_page.php
[/code]
Copy linkTweet thisAlerts:
@toplisekauthorMay 19.2008 — 
.htaccess file

Permanent Redirect

Redirect permanent /index.php /this_page.php
[/QUOTE]


Can you give me some working sample code fot this example if there are files within folders?
Copy linkTweet thisAlerts:
@bokehMay 19.2008 — Can you give me some working sample code fot this example if there are files within folders?[/QUOTE]That is a working sample.
×

Success!

Help @toplisek spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...