CodeIgniter Forums
Problem redirecting to an html page outside my application - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Problem redirecting to an html page outside my application (/thread-11627.html)



Problem redirecting to an html page outside my application - El Forum - 09-16-2008

[eluser]Jay Turley[/eluser]
In my root, there are two files:

index.html // the site index page
application.php // the CI controller for dynamic portion of site

After performing certain tasks, I wish to redirect to index.html

Obviously, using

Code:
$this->load->helper('url');
redirect('index.html');

would be a FAIL.

Not being very familiar with PHP yet, I tried

Code:
http_redirect('/index.html');

This did not work.

Can anyone out there point me toward the proper way to do this?

Thanks a ton!


Problem redirecting to an html page outside my application - El Forum - 09-16-2008

[eluser]Sumon[/eluser]
Javascript redirection might be useful one. Give it a try:
Code:
echo '[removed][removed]="http://www.your-site.com/index.html";[removed]';



Problem redirecting to an html page outside my application - El Forum - 09-16-2008

[eluser]Jay Turley[/eluser]
[quote author="Sumon" date="1221642581"]Javascript redirection might be useful one. Give it a try:
Code:
echo '[removed][removed]="http://www.your-site.com/index.html";[removed]';
[/quote]

I *hate* when it removes code... are you suggesting something like

[script]
document.location.href = "url";
[/script]


( pretend the [ are < )


Problem redirecting to an html page outside my application - El Forum - 09-16-2008

[eluser]Sumon[/eluser]
Exactly.
Sorry for my messy code. actually this is my first post of JS.


Problem redirecting to an html page outside my application - El Forum - 09-16-2008

[eluser]Jay Turley[/eluser]
Okay, thank you for the suggestion. I may do that, but I was hoping there was some solution out there involving PHP so I don't have to depend on JS support in the client browser.

Thanks!


Problem redirecting to an html page outside my application - El Forum - 09-17-2008

[eluser]Dr.Dan[/eluser]
Why not try header('Location: http://www.example.com/index.html');


Problem redirecting to an html page outside my application - El Forum - 09-17-2008

[eluser]Weblizard[/eluser]
How about this?
Code:
redirect('index', 'location');
Note: Just remove .html extension from your first post and you'll be fine


Problem redirecting to an html page outside my application - El Forum - 09-17-2008

[eluser]Jay Turley[/eluser]
[quote author="Dr.Dan" date="1221650237"]Why not try header('Location: http://www.example.com/index.html');[/quote]

And it's Dr. Dan FTW!!

Beautiful. And thank you very much! :-)