Redirecting primary domain - drupal

This is a generic webhosting question,
I am trying to redirect, my primary domain to a subfolder in the 'www' folder, which consists of 3 folders
here is a better view
www ->
Folder1
Folder2
Folder3
Folder2 is where my drupal installation is , and this is where I want my domain to go directly
Right now what is happening is I type my domain name in the browser, abc.com, then I am presented with the above mentioned 3 folders and when I click the subfolder2, I can use drupal as per normal.
I am not sure what is needed to be changed, I am sure this can be done.

What sort of web server have you got? Is it one you are self hosting?
If it's apache you can change the home page to point to the new folder. HOWEVER if you are remotely hosting it this may be more difficult and you may have to physically move the whole installation to the root.
Another solution (not a nice one) is to do an HTTP redirect by creating an index.html in the home folder with
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Your Page Title</title>
<meta http-equiv="REFRESH" content="0;Folder2"></HEAD>
<BODY>
</BODY>
</HTML>

You can use .htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?Primarydomain.com$
RewriteRule ^(/)?$ Folder2 [L]

Related

How do I make the landing page of website appear on Google and not "Index of /"?

I have recently made my WordPress website live and want it to be visible on Google Search. However, when specifically searching for the website, Google does not show the site title or description entered in WordPress, but rather "Index of /" and a bit of server info as the page summary. Does anyone recognize this, and have some ideas on how to fix this?
Apache2 is running on an Ubuntu 18.04 server and everything is updated. I have both an index.html file and obviously an index.php file in the DocumentRoot directory specified in the Virtual Host file for apache. And have specified to use index.php first in the .htaccess file. I've also tried to add the URL of the page to Google Search Console and added a sitemap, but with no effect.
You can add these lines to .htaccess files (its located in root of the website). What it does its redirects any trafic you got on http://example.com to https://example.com Please check both locations in separate browsers (and again with removed cache) on how it works. SOmetimes apache can be configured so it wouldn't work out of the box (like it can require additional fixes to redirection code or to the additional blocks etc...)
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

how to redirect custom html site to wordpress

How to Redirect
Old Link:
http://www.astrokapoor.com/products/gems/gemstones/ruby-manik-new-burmees/ (this is custom php/html site)
New Link- http://astrokapoor.com/en/ruby-manik-gemstone/ (this is wordpress site link)
I used below code but no success
RewriteRule ^/products/gems/gemstones/ruby-manik-new-burmees /en/ruby-manik-gemstone [L,R=301]
Let's assume both the source and the target reside in the different virtualhosts and that you are defining this in VirtualHost context. Let's also assume you are the admin of the site and you have no reason to define this in .htaccess context.
All you need is a Redirect directive in the source virtualhost:
Redirect /products/gems/gemstones/ruby-manik-new-burmees/ http://astrokapoor.com/en/ruby-manik-gemstone/
This will redirect /products/gems/gemstones/ruby-manik-new-burmees/ and all subpaths from it to the new url, such if someone requests:
Host: www.astrokapoor.com
GET /products/gems/gemstones/ruby-manik-new-burmees/something
they will get redirected to:
http://astrokapoor.com/en/ruby-manik-gemstone/something
Note: Redirect belongs to mod_alias. In such simple redirection cases you should avoid mod_rewrite. Use mod_rewrite only when you have no other choice.
Add this line in your old page html page.
<meta http-equiv="refresh" content="0; url=http://astrokapoor.com/en/ruby-manik-gemstone/" />
By using simple redirect plugin You can set your redirect links easily by define each URL to match each page.
Try to use this code in .htaccess file.
RewriteRule ^products/gems/gemstones/ruby-manik-new-burmees/$ http://astrokapoor.com/en/ruby-manik-gemstone/ [L]
RewriteRule ^sunsign/aquarius%4027.html/$ http://www.astrokapoor.com/en/Aquarius-sunsign/ [L]

Domain Frame redirect not responsive

So I have two Domains where one is just a domain without Webspace.
The other Domain shows to a Wordpress Installation which works fine. (www.braintwist.org)
I tried to Frame redirect the external Domain to this directory and it also works out.
(www.thebraintank.de redirected to www.braintwist.org)
The Site gets loaded in a Frameset. Unfortunatly, when I open up the site on a mobile phone the scale stays at desktop size (so the font-size is to "small" etc.)
I think its because the Frameset.
Is there a way to redirect the Domain to an external Webspace without it being loaded in a Frameset?
best regards
You could write a small php script like this (this would need to be stored as index.php and would only redirect users accessing the index.php or the "plain" domain as URL):
<?php
header('Location: http://newlocation'):
?>
or use a .htaccess file:
RewriteEngine On
RewriteRule (.*) http://newlocation/$1
or
Redirect / http://newlocation/
In the first place mod_rewrite must be loaded and for the second .htaccess example you need mod_alias.
However, in both cases you will see the new URL in the address bar of the browser.
In order to keep the URL on the addressbar you could use
RewriteEngine On
RewriteRule (.*) http://newlocation/$1 [P]
to proxy requests. This, however, requires mod_rewrite and mod_proxy to be loaded (and might cause some slower performance as all requests are done "twice" in background).
See: http://httpd.apache.org/docs/current/rewrite/ for mod_rewrite documentation.
Create a .php document and upload it to your hosting. Don't create a frame forward in your domain setting, but point the domain to the created .php document. Then use the following code in your .php document to create the frame forward there.
<html>
<head>
<title>Your Title</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-
scale=1.0; user-scalable=0">
<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' />
</head>
<frameset rows="100%" border="0" framespacing="0" frameborder="0">
<frame name="main" src="https://your-target-domain.com/" marginwidth="0"
marginheight="0" scrolling="auto"
noresize="noresize">
</frameset>
<noframes>
</noframes>
</html>
I created a link to a favicon as well. You can take this line out if you dont need it. If you need it, simply upload your favicon as "favicon.ico" into the same directory as the .php file.
Now you have a mobile responsive frame forwarding :)

Disable all parent htaccess

I have wordpress installed in the root of my website public_html
Although I have other folder inside a projects folder running their own websites.
The .htaccess in the wordpress folder (parent-most folder) might be causing issues for the inside folders.
Is there a way, I can mention for a folder not to look any higher for htaccess files ?
DETAIL:
The two main issues I am currently having our
- if I set the status code to 500, I am get redirected to my home page (index.php)
- if a page is not found, it gets redirected to index.php
Thanks.
Put this code in your .htaccess under DOCUMENT_ROOT directory (just above your wordpress rewrite stuff):
RewriteRule ^subfolder(/.*|)$ - [L]

rewrite problem : put magento inside drupal installation directory

I have put magento inside a drupal installation in a subdirectory called store.
When I access http://localhost/myshop/store magento home page is showed without problem but when i try to access any link inside magento (example http://localhost/myshop/store/admin) i get a drupal page that tells me that the page is not found !
What should I do to make all request under /store path be dispatched to magento insted of drupal ?
edit your .htaccess rewrite path to be /myshop
############################################
## you can put here your magento root folder
## path relative to web root
#RewriteBase /magento/
look for this in .htaccess and uncomment RewriteBase and change /magento/ to your directory name
In the .htaccess file for Drupal - that is, /myshop/.htaccess - add the following before the line with RewriteRule in it.
RewriteCond %{REQUEST_URI} !^/store/
This excludes your Magento directory from Drupal's rewriting and so allow Magento to continue as normal. You shouldn't need to change Magento's /myshop/store/.htaccess file for this.

Resources