I think I need mod_rewrite code...

Discussion in 'Apache' started by Jason Paul, Nov 3, 2007.

  1. #1
    Hi - new here.

    Let me preface this by saying I'm somewhat computer savvy, but am not a programmer.

    I have a main domain and a few subdomains. I have WordPress installed at the root of each. Last night I uploaded a sales letter and ebook for sale on one of my subdomains. I created two directories, one for the sales letter and one for the ebook PDF. These are inside the subdomain directory - at the same level as the wp-content directory.

    Here's my problem; both the sales letter and ebook show my main domain in the URL. Like this:

    www.maindomain.com/subdomain/shop/HTML/index.html

    I don't want my main (and completely unrelated) domain to show here. I want:

    www.subdomain/shop/HTML/index.html

    I was told that I should be able to do this with a mod_rewrite. However, not being a programmer, what I've seen quickly goes over my head, and probably beyond my needs.

    Can someone please tell me what code to use and where to put it in my htaccess file?

    Any help is much appreciated!

    Thanks,
    Jason
     
    Jason Paul, Nov 3, 2007 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    You can only redirect to www.subdomain.com/shop/HTML/index.html and it'll only work if the content is actually located at those URLs.

    Otherwise, the only option would be to edit the servers apache file. And you have to have a dedicated server for that.
     
    Nintendo, Nov 3, 2007 IP
  3. Jason Paul

    Jason Paul Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks.

    That is what I want to do, and that is where the files are located. I'm not trying to do anything tricky or deceitful, I just want to remove my main domain from the URL of my subdomain, since they are completely unrelated.

    For example, you wouldn't want someone looking around your insurance site, click on a link for an ebook, and see the URL to change, adding a new domain in front. So, they remove everything in the URL except that new domain name, and find out they're now at a dog training site.

    So for example, they're at www.insurance4all.com, click on a link and are suddenly at www.dogtraining4all.com/insurance4all/shop/html/index.html. I just made these up by the way, these are not my sites.

    What I want to do is make is so that www.dogtraining4all.com doesn't show up, it just stays as www.insurance4all.com. Make sense.

    Can this be done with a mod_rewrite? If so, would someone be able to give me the code and tell me where to put it?

    Thanks,
    Jason
     
    Jason Paul, Nov 4, 2007 IP
  4. andrewjbarnett

    andrewjbarnett Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi Jason,
    Is the insurance4all a subdomain of dogtraining4all or a totally separate domain, and being hosted as an add-on domain through cPanel?

    If its being hosted as an add-on domain, then it should be treated as a totally separate domain by the server you are hosting it on. If it is a subdomain of dogtaining4all, the removing dogtraining4all isn't possible as the insurance4all isn't an actual domain.

    Hope I made sense, if not feel free to contact me
     
    andrewjbarnett, Nov 4, 2007 IP
  5. Jason Paul

    Jason Paul Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'm not quite sure I follow it all, but here are the details. And again - these are just some silly domain names I made up, they're not mine.

    When I first got hosting and bought a domain, it was dogtraining4all.com (for the sake of clarity and privacy).

    Later, when I picked a niche to build a site for, I bought the domain name insurance4all.com, and set it up in my cPanel as an add-on domain. I then installed WordPress at the root.

    When you go to www.insurance4all.com, you get a normal WordPress site, and the URL is www.insurance4all.com/whatever... I looks normal.

    The other day I found some ebooks I want to offer on my insurance4all.com site. I went into cPanel and set up two directories under the insurance4all directory. One is "shop" for sales letters, and one is "downloads" for the ebooks.

    The problem is that when cPanel shows me the URL of those files (the sales letter and the ebook), they both show www.dogtraining4all.com/insurance4all/restoftheURL...

    So, when you're at the insurance4all.com site - all is well and that is the only domain you see. However these files I uploaded into directories I created (outside of WordPress), show both the main AND subdomains in the URL.

    It must be possible to NOT show my main domain, because it looks fine when you're on the site. It's when I use files I uploaded outside of WordPress that have a problem.

    Does that help you help me? :)

    Again - those are NOT my sites.

    Thanks,
    Jason
     
    Jason Paul, Nov 4, 2007 IP
  6. andrewjbarnett

    andrewjbarnett Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    So basically you see 'www.dogtraining4all.com/insurance4all/restoftheURL...' when you are inside cPanel, but you see the proper domain 'www.insurance4all.com/restoftheURL...' when you are browsing the site normally?

    BUT When you specifically want to download the eBooks, the 'www.dogtraining4all.com/insurance4all/restoftheURL...' shows up as the download link?

    Am I understanding that correctly? If you like, we can discuss this via PM so that you can give me the links and show me exactly what is happening, it is much easier to provide a solution when I can see the real life situation in action. Or feel free to contact me via MSN, Skype, or other method.
     
    andrewjbarnett, Nov 5, 2007 IP