redirect to a php file from htaccess

Discussion in 'HTML' started by Leif K-Brooks, Sep 28, 2006.

  1. Nospam wrote:
    > 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.
    Leif K-Brooks, Sep 28, 2006
    #1
    1. Advertising

  2. Leif K-Brooks

    Nospam Guest

    Nospam, Sep 28, 2006
    #2
    1. Advertising

  3. Leif K-Brooks

    Nospam Guest

    "Leif K-Brooks" <> wrote in message
    news:451b9f7e$0$25777$...
    > Nospam wrote:
    > > 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.


    It is an html page, is there any workaround to redirect to the html page
    without the browser failing?
    Nospam, Sep 28, 2006
    #3
  4. Leif K-Brooks

    jojo Guest

    Nospam wrote:

    >>> 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.

    >
    > 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*...
    jojo, Sep 28, 2006
    #4
  5. Leif K-Brooks

    Nospam Guest

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

    "jojo" <> wrote in message
    news:efghpq$33g$...
    > Nospam wrote:
    >
    > >>> 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.

    > >
    > > 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*...
    Nospam, Sep 28, 2006
    #5
  6. Leif K-Brooks

    jojo Guest

    Nospam wrote:
    >>>>> 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.
    >>> 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*...
    >>

    > 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 ;-)
    jojo, Sep 28, 2006
    #6
  7. Leif K-Brooks

    jojo Guest

    Nospam wrote:
    >>>>> 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.
    >>> 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*...
    >>

    > 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 ;-)
    jojo, Sep 28, 2006
    #7
  8. Leif K-Brooks

    jojo Guest

    Nospam wrote:
    >>>>> 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.
    >>> 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*...
    >>

    > 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 ;-)
    jojo, Sep 28, 2006
    #8
  9. Leif K-Brooks

    Nospam Guest

    "jojo" <> wrote in message
    news:efgo0s$899$...
    > Nospam wrote:
    > >>>>> 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.
    > >>> 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*...
    > >>

    > > 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

    ;-)

    my apologies for top posting. Is there a simple example of redirecting to
    the php file using html , css or any other way?
    Nospam, Sep 28, 2006
    #9
  10. Leif K-Brooks

    jojo Guest

    Nospam wrote:>
    >>>>>>> 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?
    >>>>>>>
    >>>> I'm sorry, but how should this work? a browser cannot display a html
    >>>> page as background-*image*...
    >>>>
    >>> 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.

    <snip>
    > 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
    jojo, Sep 28, 2006
    #10
  11. Leif K-Brooks

    Dan Guest

    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?

    --
    Dan
    Dan, Sep 28, 2006
    #11
  12. Leif K-Brooks

    Nospam Guest

    "Dan" <> wrote in message
    news:...
    >
    > 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?
    >
    > --
    > Dan


    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?
    Nospam, Sep 29, 2006
    #12
  13. "Nospam" <> skrev i meddelandet
    news:uc_Sg.42785$...
    >
    > "Dan" <> wrote in message
    > news:...
    > >
    > > 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?
    > >
    > > --
    > > Dan

    >
    > 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?

    --
    Luigi Donatello Asero
    https://www.scaiecat-spa-gigi.com/it/svezia.html
    我居ä½åœ¨ç‘žå…¸
    Luigi Donatello Asero, Sep 29, 2006
    #13
  14. Leif K-Brooks

    Nospam Guest

    "Luigi Donatello Asero" <> wrote in message
    news:_j_Sg.17981$...
    >
    > "Nospam" <> skrev i meddelandet
    > news:uc_Sg.42785$...
    > >
    > > "Dan" <> wrote in message
    > > news:...
    > > >
    > > > 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?
    > > >
    > > > --
    > > > Dan

    > >
    > > 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?
    >
    > --
    > Luigi Donatello Asero
    > https://www.scaiecat-spa-gigi.com/it/svezia.html
    > ??????
    >
    >

    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
    Nospam, Sep 29, 2006
    #14
  15. Leif K-Brooks

    Dan Guest

    Nospam wrote:
    > 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?

    --
    Dan
    Dan, Sep 29, 2006
    #15
  16. Leif K-Brooks

    Nospam Guest

    "Dan" <> wrote in message
    news:...
    >
    > Nospam wrote:
    > > 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?
    >
    > --
    > Dan
    >


    Is there an example of how I could do this with an i-frame or server side
    include?
    Nospam, Sep 29, 2006
    #16
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Dorward
    Replies:
    2
    Views:
    1,699
    Art Sackett
    Jun 29, 2003
  2. John Bokma
    Replies:
    0
    Views:
    879
    John Bokma
    Jun 28, 2003
  3. brucie
    Replies:
    0
    Views:
    743
    brucie
    Jun 28, 2003
  4. Florent
    Replies:
    1
    Views:
    621
    Dave Patton
    Feb 2, 2005
  5. Rajive Narain
    Replies:
    0
    Views:
    1,733
    Rajive Narain
    Sep 18, 2009
Loading...

Share This Page