• Resolved matchboxben

    (@matchboxben)


    Hi All,

    I’m going to try and be as descriptive as possible – apologies if im not completely clear, but any help you could give would be really appreciated!

    So i have got 5 blogs.

    In the following places:

    exampleblog.com
    exampleblog.com/anotherblog1
    (also set up on anotherblog1.exampleblog.com)

    exampleblog.com/anotherblog2
    (also set up on anotherblog2.exampleblog.com)

    exampleblog.com/anotherblog3
    (also set up on anotherblog3.exampleblog.com)

    exampleblog.com/anotherblog4
    (also set up on anotherblog4.exampleblog.com)

    These are all set up to run from the same sql database and are sharing a table of users – each blog has it’s own prefix within the database.

    The domain names are hosted with 1&1 and the web hosting is with heart internet.

    I’ve got the domain name “exampleblog.com” pointed at heart-internet’s dns.

    I want the “www.” to allways appear in the url – currently typing in “www.exampleblog.com” takes me to “www.com” if i type “exampleblog.com” it works.

    I also would like to point a bunch of domain names at each of the above blog subdomains – masking the subdomain so that no matter how the user gets to “anotherblog4.exampleblog.com” for example, the url in the addressbar will say “www.anotherblog4.com”.

    Apologies if this isnt clear, happy to give more info if needed.

    Ben.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Usually you do the www or non-www via the .htaccess file. For example:

    # mod_rewrite in use
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain\.com [NC]
    RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301]
    RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
    RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]
    RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
    RewriteRule ^(.*)$ https://www.domain2.com/$1 [L,R=301]

    First example redirects the domain to the “www.” version.
    The second example redirects the “www.” version to the non “www.” version.
    Third example redirects the first domain to a second domain.

    Thread Starter matchboxben

    (@matchboxben)

    Hi Alexlr, thanks SO much for response, i’m completely stuck as to what’s going on here…

    I’ve tried this but for some reason its now removing the domain part and redirecting to “www.com”

    so if i type https://www.exampleblog.com or https://exampleblog.com it redirects to “www.com”…

    Crap, the top example is wrong. Needs an escape for .com. Top example should read:

    RewriteCond %{HTTP_HOST} ^domain\.com [NC]
    RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301]

    Thread Starter matchboxben

    (@matchboxben)

    It’s still redirecting to “www.com” for some reason – i’m baffled!

    Can you post what your .htaccess file looks like for the redirection? You can change the domain names to protect the innocent but I want to see what you have written in there.

    Thread Starter matchboxben

    (@matchboxben)

    It’s still just the default text included as standard..

    This is my set up.

    Main Site – https://www.mainsite.com

    Sub site1 – subsite1.mainsite.com/ OR mainsite.com/subsite1
    Sub site2 – subsite2.mainsite.com/ OR mainsite.com/subsite2
    sub site3 – subsite3.mainsite.com/ OR mainsite.com/subsite3

    I also have the full domains “www.subsite1.com, https://www.subsite2.com & https://www.subsite3.com”

    Now what i want is to point those full domains at the the sub-url’s above, and have the first part always masked with the full domain..

    so
    “subsite1.mainsite.com” and “mainsite.com/subsite1” will always be replaced with https://www.subsite1.com.

    For example .. subsite3.mainsite.com/content would automatically be replaced with “www.subsite3.com/content”.

    I’m aware this can’t be completely solved with URL rewrites, but i’m concious that this will need to be right..

    Any advice you can give on how to achieve the above would be very thankfully recieved!

    Ben.

    Thread Starter matchboxben

    (@matchboxben)

    Ok so i solved some of the problems myself.

    Now i when typing in “www.domain2.com” it brings up the correct directory… however as soon as i click a link it reverts to the old full domain – ie https://www.maindomain.com/domain2/content/ where as i want it to be https://www.domain2.com/content…

    – here’s my new code:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    #
    RewriteCond %{HTTP_HOST} https://www.corrieomg.com
    RewriteCond %{REQUEST_URI} !corrieomg/
    RewriteRule ^(.*)$ corrieomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} https://www.eastendersomg.com
    RewriteCond %{REQUEST_URI} !eastendersomg/
    RewriteRule ^(.*)$ eastendersomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} https://www.emmerdaleomg.com
    RewriteCond %{REQUEST_URI} !emmerdaleomg/
    RewriteRule ^(.*)$ emmerdaleomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} https://www.hollyoaksomg.com
    RewriteCond %{REQUEST_URI} !hollyoaksomg/
    RewriteRule ^(.*)$ hollyoaksomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} https://www.corrieomg.co.uk
    RewriteCond %{REQUEST_URI} !corrieomg/
    RewriteRule ^(.*)$ corrieomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} https://www.eastendersomg.co.uk
    RewriteCond %{REQUEST_URI} !eastendersomg/
    RewriteRule ^(.*)$ eastendersomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} https://www.emmerdaleomg.co.uk
    RewriteCond %{REQUEST_URI} !emmerdaleomg/
    RewriteRule ^(.*)$ emmerdaleomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} https://www.hollyoaksomg.co.uk
    RewriteCond %{REQUEST_URI} !hollyoaksomg/
    RewriteRule ^(.*)$ hollyoaksomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} corrieomg.com
    RewriteCond %{REQUEST_URI} !corrieomg/
    RewriteRule ^(.*)$ corrieomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} eastendersomg.com
    RewriteCond %{REQUEST_URI} !eastendersomg/
    RewriteRule ^(.*)$ eastendersomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} emmerdaleomg.com
    RewriteCond %{REQUEST_URI} !emmerdaleomg/
    RewriteRule ^(.*)$ emmerdaleomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} hollyoaksomg.com
    RewriteCond %{REQUEST_URI} !hollyoaksomg/
    RewriteRule ^(.*)$ hollyoaksomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} corrieomg.co.uk
    RewriteCond %{REQUEST_URI} !corrieomg/
    RewriteRule ^(.*)$ corrieomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} eastendersomg.co.uk
    RewriteCond %{REQUEST_URI} !eastendersomg/
    RewriteRule ^(.*)$ eastendersomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} emmerdaleomg.co.uk
    RewriteCond %{REQUEST_URI} !emmerdaleomg/
    RewriteRule ^(.*)$ emmerdaleomg/$1 [L]
    #
    RewriteCond %{HTTP_HOST} hollyoaksomg.co.uk
    RewriteCond %{REQUEST_URI} !hollyoaksomg/
    RewriteRule ^(.*)$ hollyoaksomg/$1 [L]
    #

    </IfModule>

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    Thread Starter matchboxben

    (@matchboxben)

    It’s fine actually guys – i managed to resolve it in the end – if anyone needs help with the same problem let me know ??

    @ matchboxben I’d like to do a similar thing with a slight difference, I think :

    – I maintain a bilingual website with 2 domains : folkawards.ca and prixfolk.ca

    – When finished with changes, my WP installation will physically be in folkawards.ca

    – Prixfolk.ca will MIRROR folkawards.ca (because the french URL pages are different content so no Google issues here)

    – I want visitors to the French pages to see URLs like : prixfolk.ca/admissibilite and I want to be able to use links to pages so that this will properly resolve (in both languages)

    – English visitors would see URL folkawards.ca/eligibility

    – I’m not 100% sure how to set up rewrites for this in .htaccess

    – I need to know if this would be overwritten when doing auto updates

    Can you help me? It looks like you’ve been dealing with the same issue…

    @matchboxben I think I have the same issue as you –

    Basically, I have a wordpress site set up on a dev server. The production server at my work refuses to host wordpress. So ideally, I’d like to redirect ourproductionserver.edu to ourdevserver.edu and mask the URLs so no one is the wiser. Is that what you were doing? I can get the university to do some of it on their end, but because wordpress generates so many absolute links, it’s ourdevserver.edu all over the place in the source of the page, so their masking doesn’t work.

    @ matchboxben –

    I’m having the same issue… Any chance you could let me know what you did to fix it?

    thanks!!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘URL Redirects/ Rewrites – Replacing “https://” with “https://www.” and masking URL’ is closed to new replies.