how to redirect everysubdomain to main domain? like anysubdomain.domain to domain in wordpress

how to redirect everysubdomain to main domain? like anysubdomain.domain to domain in wordpress

Content Index :

how to redirect everysubdomain to main domain? like anysubdomain.domain to domain in wordpress
Tag : wordpress , By : barefootChild
Date : November 24 2020, 01:01 AM

I think the issue was by ths following , First, remove the write permissions from your .htaccess file because WordPress is notorious for overwriting them. In .htaccess in your public_html root directory, add the following lines of code. Before you do this though, change the site url in settings >> general.
# .htaccess main domain to subdirectory redirect 
# Do not change this line. 
RewriteEngine on 
# Change example.com to be your main domain. 
RewriteCond %{HTTP_HOST} ^(www.)?example.com$ 
# Change 'subdirectory' to be the directory you will use for your main domain. 
RewriteCond %{REQUEST_URI} !^/subdirectory/ 
# Don't change the following two lines. 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
# Change 'subdirectory' to be the directory you will use for your main domain. 
RewriteRule ^(.*)$ /subdirectory/$1 
# Change example.com to be your main domain again. 
# Change 'subdirectory' to be the directory you will use for your main domain 
# followed by / then the main file for your site, index.php, index.html, etc. 
RewriteCond %{HTTP_HOST} ^(www.)?example.com$ 
RewriteRule ^(/)?$ subdirectory/index.html [L]

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

htacess file to redirect azure defualt domain to main domain

Tag : php , By : Matt Logan
Date : March 29 2020, 07:55 AM
will help you If Both the url are pointing to single location then use the following
RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www.old_site.com$ [NC]
    RewriteRule ^(.*)$ http://www.new_site.com/$1 [L,R=301]

How to check if the main domain matches a certain domain and then redirect the request in .htaccess?

Tag : apache , By : user187383
Date : March 29 2020, 07:55 AM
wish help you to fix your issue What I want to accomplish is that when the user tries to visit the site with url like the following : , Unless I am missing something you can simplify this by using:
RewriteEngine On

## Avoid use of HTTPS for TEST SERVER

# if current host is test
RewriteCond %{HTTP_HOST} ^test\.canvas-events\.co\.uk$ [NC]
# and if HTTPS is turned on
RewriteCond %{HTTPS} on
# redirect to non-HTTPS version
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

## Redirect all www or non www to https

# if HTTPS is off
RewriteCond %{HTTPS} !on [OR]
# OR if current host canvas-events.co.uk (non-www)
RewriteCond %{HTTP_HOST} ^canvas-events\.co\.uk$ [NC]
# redirect to https and www
RewriteRule ^ https://www.canvas-events.co.uk%{REQUEST_URI} [L,R=301,NE]

Redirect Wordpress main domain index.php to a page (same domain)

Tag : wordpress , By : Gazza
Date : March 29 2020, 07:55 AM
wish helps you Just a quick query. Checking your thoughts on how to redirect a Wordpress main domain index.php to a page (same domain). For example, my WordPress domain is https://maindomain.com which is the same as https://maindomain.com/index.php. I prefer to redirect permanently to https://maindomain.com/page/ via .htaccess. All other pages should work as intended, and this is specific only to the WordPress index page. Any help would really be appreciated. ! , Try this
RewriteEngine On

RewriteRule ^$ https://maindomain.com/page/ [L,R]

allow access to one page on sub-domain, and if tried accessing other pages redirect to main domain

Tag : ruby-on-rails , By : Hunter
Date : March 29 2020, 07:55 AM
I hope this helps you . Define all your routes and after it define constraint for app subdomain. You need to match test route and use redirect for all other subdomain routes. Specify only blank subdomain in redirect parameters, in this case it will get all other info from request and only change subdomain to main domain
get 'campaigns/test', to: redirect(subdomain: 'app'), constraints: { subdomain: '' }
get '/campaigns/:slug', to: 'campaigns#show'
post '/cam_enquiry', to: 'campaigns#cam_enquiry'

constraints subdomain: 'app' do
  get 'campaigns/test', to: 'contoroller#action'
  get '/*any', to: redirect(subdomain: '')

How to .htaccess redirect domain to subdomain while keeping the main domain intact

Tag : .htaccess , By : John Tate
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • How to pass URL variables into a WordPress page
  • trying to find the comment hook I need for wordpress?
  • What kind of Plugin is the New Playstation Share Blog using | Wordpress
  • Best WP blank(naked) template?
  • Chrome cache won't update in my site
  • WP: redirect users to a certain category using cookies
  • cart and checkout doesn't work in woocommerce
  • Pass the value of the ACF field to the hidden Ninja forms field
  • Why am I suddenly recieving Access Forbidden Error 403 when trying to access localhost/phpmyadmin?
  • Error 500 when changing .htaccess file on production server
  • When products are being updated using a script function (by a cron), is there any way to identify or trace the function
  • How to remove or hide decimals on weight values in Woocommerce
  • Incorrect URL on Wordpress using Docker
  • Add donation check box only to customers from CA
  • Reuse WC_Admin_List_Table_Products from woocommerce to customize table and actions
  • Wordpress admin admin change button text add new
  • ACF group content in Elementor?
  • Get an array of category details with category name in WordPress
  • Htaccess redirectmatch only works for http urls
  • Get children category of a taxonomy by parent id
  • Wordpress fails to load scripts
  • Wordpress 3 latest blog post in Bootsrap4 carousel
  • WP or function adding extra br tag
  • I want to retreive all images in a wordpress post (all from the media gallery) and show them in a lighbox
  • Items in Wordpress widget forms are being hidden whenever they are initially are added, what could be causing this issue
  • Connecting to my local docker Database Instance from Table Plus
  • How to exclude a country in WooCommerce EU VAT
  • How search replace image url in wordpress visual composer
  • how to set different navbar for my landing page in wordpress
  • Woocommerce Product Bundle import via WP All Import
  • A way to import only certain Blogger posts to Wordpress
  • Including vendor CSS and JS in wordpress?
  • How can I add a " Call" button beside "add to cart" button in woocommerce
  • "Add post" sometimes overwriting a previous post Wordpress
  • Adding multi-level menu's with Timber
  • Pulling Single Post Featured Image under a Category List
  • How to get user_id within BuddyPress email template to use for PHP functions
  • How to change URL of item in Wordpress dashboard in order to go directly to first post inside it
  • How to display first post of each tag
  • Dropdown list of roles, link role name to ID
  • Wordpress – Loading different CSS for different page not working
  • Visual composer Converting Double quote ("some text") into back quote ( ``some text`` )
  • How does WordPress default docker image copies files into the host system?
  • Wordpress add rewrite rule doesn't work for me
  • When can't I update my files on theme editor of Wordpress?
  • Problem with redirect in htaccess wordpress
  • Error with Gatsby plugin Gatsby-Source-Wordpress
  • Can I create a second custom tag system for wordpress?
  • WooCommerce cart items number based on unique products
  • Enabling wordpress with a flask app using nginx
  • I need help generating a custom URL based on the user ID
  • How to add anchor support to a core block?
  • change 'update cart' text in cart page Woocommerce
  • WooCommerce Scheduled Actions Tab
  • Wordpress - Multiple Checkboxes at least 1 checkbox should be required in Contact Form 7
  • Fatal error: Uncaught Error: Cannot use object of type WP_Error as array
  • Add custom classes to "wp_get_attachment_image( $attachment_id)" wordpress function
  • Include image assets in a WordPress Gutenberg Block Plugin
  • Wordpress wants to install itself, rather than run the blog
  • wordpress divi active responsive menu by default
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com