Redirect a subdomain to a menu-item created in maindomain

Discuss Search Engine Optimization in relation to Joomla! 3.x. This forum will also have discussions on SEF/SEO Joomla! 3.x extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
rascar
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Thu Sep 03, 2009 9:27 pm

Redirect a subdomain to a menu-item created in maindomain

Postby rascar » Mon Mar 12, 2018 7:06 pm

Hi there,

I want to create a .htaccess file for a rewriterule to show the content of "https://maindomain.com/menuitem" (this menuitem is allready SEO-set by joomla) to "https://menuitem.maindomain.com"

I'll make the .htaccess file in the subdomain, but I've tried multiple options but I can't figure it out to make it work.

How do i do this?

User avatar
semnaveen
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 109
Joined: Fri Jan 09, 2015 12:25 am
Location: Delhi
Contact:

Re: Redirect a subdomain to a menu-item created in maindomain

Postby semnaveen » Tue Mar 13, 2018 7:52 am

As, I am understanding that you want to redirect this page ( https://maindomain.com/menuitem ) to here (https://menuitem.maindomain.com)

If I am write, then you dont have to create redirect file on subdomain. You need to create it on main domain so when user will come on the main domain, he will be redirected to Subdomain.

Simply use : Redirect oldurl newulr

Please let me know if I am right.
We released another Free Joomla Template!! Check it out
Download Free Joomla Templates ► https://www.joomdev.com/products/templates
Free Internet Marketing and Tech Tricks: http://www.f5therefresh.com

rascar
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Thu Sep 03, 2009 9:27 pm

Re: Redirect a subdomain to a menu-item created in maindomain

Postby rascar » Tue Mar 13, 2018 11:55 am

Your right but i cant seem to make it work.

I've forced also the maindomain to use non-www in the rewriterule so I've set up now the next but nothing seems to work...

The redirect you mention doesnt work either...

Code: Select all

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

User avatar
pixelprojects
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Wed Mar 18, 2009 12:26 pm
Contact:

Re: Redirect a subdomain to a menu-item created in maindomain

Postby pixelprojects » Wed Mar 14, 2018 7:09 pm

The .htaccess entry needs to be in the main domain (the source domain). So try adding the following:

Code: Select all

RewriteEngine on
RewriteBase /


RewriteCond %{HTTP_HOST} !^menuitem\.website\.com$ [NC]
RewriteRule ^menuitem/$ http://menuitem.maindomain.com [L,NC,R=301]


Do note that sub-domains are seen as entirely different sites by search engines so any content on sub-domains will dilute your main domain's authority. I'm note sure if that's relevant in your situation, but it's worth mentioning.

Hope the above works.
Web Design, Digital Marketing, Photography, Photoshop - http://www.pixelprojects.net

tuvidalaboral
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Mar 28, 2018 2:54 pm

Re: Redirect a subdomain to a menu-item created in maindomain

Postby tuvidalaboral » Wed Mar 28, 2018 3:11 pm

You need to add a rewrite rule to the .htaccess file at the root of the domain.

Code: Select all

RewriteEngine on
RewriteBase /

RewriteRule ^/menuitem/(.*)$ http://menuitem.maindomain.com/$1 [R=301,L]


This will also redirect all the subfolters ->

example.com/blog/this-is-the-blogpost 301-> blog.example.com/this-is-the-blogpost

Hope it helps


Return to “Search Engine Optimization (Joomla! SEO) in Joomla! 3.x”

Who is online

Users browsing this forum: No registered users and 2 guests