redirect to a php file from htaccess

L

Leif K-Brooks

Nospam said:
I have a redirect in my htaccess to a php file, however I am trying to see
if the redirect works from css, by this code
body{background-image:url(http://www.example.com/redirect1.html); should
redirect to

(http://www.example.com/redirect1.php); but for some strange reason doesn't
work in the css, does anyone know what is wrong?

Is http://www.example.com/redirect1.php an image, or is it an HTML page?

If it's an image, it should become the page's background image. If it's
just an HTML page, as I suspect it is, then the browser will try to use
it as a background image but fail.
 
G

Guest

Leif K-Brooks said:
Is http://www.example.com/redirect1.php an image, or is it an HTML page?

If it's an image, it should become the page's background image. If it's
just an HTML page, as I suspect it is, then the browser will try to use
it as a background image but fail.

It is an html page, is there any workaround to redirect to the html page
without the browser failing?
 
J

jojo

Nospam said:
It is an html page, is there any workaround to redirect to the html page
without the browser failing?
I'm sorry, but how should this work? a browser cannot display a html
page as background-*image*...
 
G

Guest

I meant is there an alternative way of using the html page as a redirection
apart from using it as a background image?
 
J

jojo

Nospam said:
I meant is there an alternative way of using the html page as a redirection
apart from using it as a background image?
Oh, sorry, I got you wrong than. I guessed that you want to load a
random background-image or something like that using that php script. So
if I got you right you are searching for a way to load a different
document using CSS? or what exactly are you looking for? I do not really
understand what you are planning to do, I'm sorry.
The redirection works, no matter how is called. You can call it via the
browsers address-bar, via any HTML.code, it doesn't matter.
the browser just recognises that something or somebody wants to get the
file and sends the file you redirect to instead of the file which the
browser (or whatever wanted to get the file) wanted to have... quite
simple, I hope my explanation wasn't that complicated..
HTH, jojo

BTW: please make sure that your posting goes *behind* the quote, makes
reading simpler if you can read from the top to the bottom instead of
the way round... thank you!
And please try to configure your OE better, look at the terrible quotes
in your posts... or, would even be better, don't use OE... thanks again ;-)
 
J

jojo

Nospam said:
I meant is there an alternative way of using the html page as a redirection
apart from using it as a background image?
Oh, sorry, I got you wrong than. I guessed that you want to load a
random background-image or something like that using that php script. So
if I got you right you are searching for a way to load a different
document using CSS? or what exactly are you looking for? I do not really
understand what you are planning to do, I'm sorry.
The redirection works, no matter how is called. You can call it via the
browsers address-bar, via any HTML.code, it doesn't matter.
the server just recognises that something or somebody wants to get the
file and sends the file you redirect to instead of the file which the
browser (or whatever wanted to get the file) wanted to have... quite
simple, I hope my explanation wasn't that complicated..
HTH, jojo

BTW: please make sure that your posting goes *behind* the quote, makes
reading simpler if you can read from the top to the bottom instead of
the way round... thank you!
And please try to configure your OE better, look at the terrible quotes
in your posts... or, would even be better, don't use OE... thanks again ;-)
 
J

jojo

Nospam said:
I meant is there an alternative way of using the html page as a redirection
apart from using it as a background image?
Oh, sorry, I got you wrong than. I guessed that you want to load a
random background-image or something like that using that php script. So
if I got you right you are searching for a way to load a different
document using CSS? or what exactly are you looking for? I do not really
understand what you are planning to do, I'm sorry.
The redirection works, no matter how is called. You can call it via the
browsers address-bar, via any HTML-code, it doesn't matter.
the server just recognises that something or somebody wants to get the
file and sends the file you redirect to instead of the file which the
browser (or whatever wanted to get the file) wanted to have... quite
simple, I hope my explanation wasn't that complicated..
HTH, jojo

BTW: please make sure that your posting goes *behind* the quote, makes
reading simpler if you can read from the top to the bottom instead of
the way round... thank you!
And please try to configure your OE better, look at the terrible quotes
in your posts... or, would even be better, don't use OE... thanks again ;-)
 
G

Guest

jojo said:
Oh, sorry, I got you wrong than. I guessed that you want to load a
random background-image or something like that using that php script. So
if I got you right you are searching for a way to load a different
document using CSS? or what exactly are you looking for? I do not really
understand what you are planning to do, I'm sorry.
The redirection works, no matter how is called. You can call it via the
browsers address-bar, via any HTML-code, it doesn't matter.
the server just recognises that something or somebody wants to get the
file and sends the file you redirect to instead of the file which the
browser (or whatever wanted to get the file) wanted to have... quite
simple, I hope my explanation wasn't that complicated..
HTH, jojo

BTW: please make sure that your posting goes *behind* the quote, makes
reading simpler if you can read from the top to the bottom instead of
the way round... thank you!
And please try to configure your OE better, look at the terrible quotes
in your posts... or, would even be better, don't use OE... thanks again
;-)

my apologies for top posting. Is there a simple example of redirecting to
the php file using html , css or any other way?
 
J

jojo

Nospam wrote:>
Is there a simple example of redirecting to
the php file using html , css or any other way?
why do you need HTML to redirect? use .htaccess:

Redirect permanent /file.html http://www.domain.de/file2.html

or php:

header("Location: http://www.example.com/file2.html");

but it is possible with HTML:

<meta http-equiv="refresh" content="0; URL=file2.html">

But if you can avoid using the "meta-refresh" don't use it. It's some
kind of "dirty" and ASFAIK it does not work with all browsers (but with
the most)

HTH, jojo
 
D

Dan

Nospam said:
I meant is there an alternative way of using the html page as a redirection
apart from using it as a background image?
[top-posting snipped]

Where did you ever get the bizarre idea that using an HTML page
(redirected or not) as a background image would work as a way to
redirect the page? It doesn't.

As for what a *real* way of doing such a redirect would be, how about
maybe redirecting the URL of the *page* itself using .htaccess, rather
than of the background image in the CSS?
 
G

Guest

Dan said:
I meant is there an alternative way of using the html page as a redirection
apart from using it as a background image?
[top-posting snipped]

Where did you ever get the bizarre idea that using an HTML page
(redirected or not) as a background image would work as a way to
redirect the page? It doesn't.

As for what a *real* way of doing such a redirect would be, how about
maybe redirecting the URL of the *page* itself using .htaccess, rather
than of the background image in the CSS?

My apologies again for the questions, but I what I have is a page linking to
a particular image on a certain page, I would like to redirect the link to
that image without having to redirect the entire html page, just that little
section that is linking to the image to my php file, is this not possible?
maybe not with css but something else?
 
L

Luigi Donatello Asero

Nospam said:
Dan said:
I meant is there an alternative way of using the html page as a redirection
apart from using it as a background image?
[top-posting snipped]

Where did you ever get the bizarre idea that using an HTML page
(redirected or not) as a background image would work as a way to
redirect the page? It doesn't.

As for what a *real* way of doing such a redirect would be, how about
maybe redirecting the URL of the *page* itself using .htaccess, rather
than of the background image in the CSS?

My apologies again for the questions, but I what I have is a page linking to
a particular image on a certain page, I would like to redirect the link to
that image without having to redirect the entire html page, just that little
section that is linking to the image to my php file, is this not possible?
maybe not with css but something else?

I guess it is
Where is the image?
 
G

Guest

Luigi Donatello Asero said:
Nospam said:
Dan said:
Nospam wrote:
I meant is there an alternative way of using the html page as a redirection
apart from using it as a background image?
[top-posting snipped]

Where did you ever get the bizarre idea that using an HTML page
(redirected or not) as a background image would work as a way to
redirect the page? It doesn't.

As for what a *real* way of doing such a redirect would be, how about
maybe redirecting the URL of the *page* itself using .htaccess, rather
than of the background image in the CSS?

My apologies again for the questions, but I what I have is a page
linking
to
a particular image on a certain page, I would like to redirect the link to
that image without having to redirect the entire html page, just that little
section that is linking to the image to my php file, is this not possible?
maybe not with css but something else?

I guess it is
Where is the image?
The image is on a domain:

http://www.example.com/image1.jpg

and on the html http://www.example.com/redirect.html

I would like to redirect all links to the image (ideally within the window
the image occupies) to my php file which is at
http://www.example.com/redirect.php , still within my
http://www.example.com/redirect.html page. I am unsure which is the best
way to go through this
 
D

Dan

Nospam said:
I would like to redirect all links to the image (ideally within the window
the image occupies) to my php file which is at
http://www.example.com/redirect.php , still within my
http://www.example.com/redirect.html page. I am unsure which is the best
way to go through this

You can redirect an image, but only to another image, not an HTML page.
It would be all right to redirect it to a PHP document, if what the
PHP code does is output an image. Since the place you're referencing
the image is as the background image of a section of an HTML page, the
only thing that's appropriate to use there is another image.

Perhaps what you really are trying to do could be accomplished with a
different method, such as an iframe or a server-side include?
 
G

Guest

Dan said:
You can redirect an image, but only to another image, not an HTML page.
It would be all right to redirect it to a PHP document, if what the
PHP code does is output an image. Since the place you're referencing
the image is as the background image of a section of an HTML page, the
only thing that's appropriate to use there is another image.

Perhaps what you really are trying to do could be accomplished with a
different method, such as an iframe or a server-side include?

Is there an example of how I could do this with an i-frame or server side
include?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top