Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder sitNsmile's Avatar
    Join Date
    Dec 2009
    Location
    Charlotte, NC
    Posts
    358
    Thanks
    19
    Thanked 2 Times in 2 Posts

    HTACCESS rewrite

    Okay, I believe it can be done here, I just not sure how to do a sub domain,

    I want the end user to see

    domain.com/ads/

    but I want the script to be on

    ads.domain.com

    This possible?

  • #2
    Regular Coder sitNsmile's Avatar
    Join Date
    Dec 2009
    Location
    Charlotte, NC
    Posts
    358
    Thanks
    19
    Thanked 2 Times in 2 Posts
    Guess it seems no one understands how to do this type of modification.

  • #3
    Regular Coder sitNsmile's Avatar
    Join Date
    Dec 2009
    Location
    Charlotte, NC
    Posts
    358
    Thanks
    19
    Thanked 2 Times in 2 Posts
    Thought I'd share how this can be done.

    Code:
    RewriteRule ^ads/(.*)$ http://ads.domain.com/$1 [P,NC]
    Which after testing, decided it wasn't going to work with how I have the program setup, but I'll resolve the post with the correct code.

    Took a lot of modification to test this, but it worked pretty well. Its important that the P is there. Requires modifications on the server to support it

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Why is this in the PHP forum? Moving from PHP to Apache Configurations forum.

    Sorry, you said this did work right? It should be fine, the P flag will push it through the mod_proxy to switch it to a different host (it also implies that this is the last rule as well). I've seen this behaviour used for alternative media servers such as images and whatnots, but I've never before seen it used for direct redirection to a url. The limitation of this is that it now becomes completely dependent on Apache itself.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #5
    Regular Coder sitNsmile's Avatar
    Join Date
    Dec 2009
    Location
    Charlotte, NC
    Posts
    358
    Thanks
    19
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Fou-Lu View Post
    Why is this in the PHP forum? Moving from PHP to Apache Configurations forum.

    Sorry, you said this did work right? It should be fine, the P flag will push it through the mod_proxy to switch it to a different host (it also implies that this is the last rule as well). I've seen this behaviour used for alternative media servers such as images and whatnots, but I've never before seen it used for direct redirection to a url. The limitation of this is that it now becomes completely dependent on Apache itself.

    Thanks Fou-Lu, yes it does work correct, but its not working out because its producing duplicate results. and I didnt know their was an Apache Config forum.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •