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?
Redirect a subdomain to a menu-item created in maindomain
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.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
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.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
-
- Joomla! Apprentice
- Posts: 5
- Joined: Thu Sep 03, 2009 9:27 pm
- semnaveen
- I've been banned!
- Posts: 121
- Joined: Fri Jan 09, 2015 12:25 am
- Location: Delhi
- Contact:
Re: Redirect a subdomain to a menu-item created in maindomain
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.
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.
-
- Joomla! Apprentice
- Posts: 5
- Joined: Thu Sep 03, 2009 9:27 pm
Re: Redirect a subdomain to a menu-item created in maindomain
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...
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]
- pixelprojects
- Joomla! Apprentice
- Posts: 5
- Joined: Wed Mar 18, 2009 12:26 pm
- Contact:
Re: Redirect a subdomain to a menu-item created in maindomain
The .htaccess entry needs to be in the main domain (the source domain). So try adding the following:
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.
Code: Select all
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^menuitem\.website\.com$ [NC]
RewriteRule ^menuitem/$ http://menuitem.maindomain.com [L,NC,R=301]
Hope the above works.
Web Design, Digital Marketing, Photography, Photoshop - http://www.pixelprojects.net
-
- Joomla! Fledgling
- Posts: 2
- Joined: Wed Mar 28, 2018 2:54 pm
Re: Redirect a subdomain to a menu-item created in maindomain
You need to add a rewrite rule to the .htaccess file at the root of the domain.
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
Code: Select all
RewriteEngine on
RewriteBase /
RewriteRule ^/menuitem/(.*)$ http://menuitem.maindomain.com/$1 [R=301,L]
example.com/blog/this-is-the-blogpost 301-> blog.example.com/this-is-the-blogpost
Hope it helps
- Webdongle
- Joomla! Master
- Posts: 44088
- Joined: Sat Apr 05, 2008 9:58 pm
Re: Redirect a subdomain to a menu-item created in maindomain
@rascar
You don't need to make a rule in .htaccess. As https://maindomain.com/menuitem is menutype external url then https://maindomain.com/menuitem will always redirect to the url it is set at.
You don't need to make a rule in .htaccess. As https://maindomain.com/menuitem is menutype external url then https://maindomain.com/menuitem will always redirect to the url it is set at.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".