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 :)
Related
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]
I set up a maintenance page for my site so when users visit, they are returned with the 503 status and redirected to a custom maintenance.php page. So it works fine and I can clearly see in my browsers that it is properly returning 503 as long as I manually enter URL's in my search address bar.
The issue is if someone clicks a link to certain pages from a Referrer, let's say from Facebook, it will redirect them to the maintenance.php page but for some reason it fails to load the CSS files and images associated with it. The CSS files and images suddenly return a 503 status as well.
My site by default will also redirect "http" pages to use "https" and "www". If I run the same page in just "http", the CSS files and images will load.
Then, if I run the page in "https" with no "www" in the URL, the page will load the CSS files and images.
So it seems as long as "https" and "www" are both in the URL, the page, its' CSS files, and its' images will all return 503.
My 503 status is configured in my .htaccess file:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REMOTE_ADDR} !^123\.45\.67\.89$
RewriteCond %{DOCUMENT_ROOT}/maintenance.php -f
RewriteCond %{DOCUMENT_ROOT}/maintenance.enable -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.php
RewriteRule ^.*$ /maintenance.php [R=503,L]
ErrorDocument 503 /maintenance.php
Header Set Cache-Control "max-age=0, no-store"
The server is running Apache. Is there a configuration I can use that will make sure the CSS files and images load when someone clicks a link that includes "https" and "www" in the URL?
Edit: It also seems the pages with this issue do not have their URL's redirect to maintenance.php either. Although they still display the maintenance.php content despite this.
It turns out the solution was simple. In my maintenance.php I just needed to change the relative paths to absolute paths instead for the CSS files and images by adding a "/" in front.
i.e.
Originally was:
<link href="css/maintenance.css" rel="stylesheet" type="text/css">
Changed to:
<link href="/css/maintenance.css" rel="stylesheet" type="text/css">
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]
I am currently using Apache Server to run my script with the URL:
http://MY_IP/cgi-bin/example.cgi/
which works fine.
However, I'm not sure where to put my .css file. I read that it doesn't belong in the cgi-bin directory.
This is what I have in my 000-default.conf file.
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
I have tried placing it in here and used:
<link rel="stylesheet" type="text/css" href="/var/www/html/login.css"/>
but to no avail.
Could someone please help me out with this?
Thank you.
Looks like you put it in the right place. It's just the href that you've got wrong.
Your Apache config contains this line
DocumentRoot /var/www/html
This means the the root of your web site is at /var/www/html. So a URL that looks at the root of your web site will translate to a file in that directory.
The href attribute is a URL, not a file path. Therefore, if you put your login.css in this directory, then the correct link would be:
<link rel="stylesheet" type="text/css" href="/login.css" />
But many people would put their CSS files in a subdirectory called /css/ (which maps to /var/www/html/css on your filesystem). If you do that, then the correct link becomes.
<link rel="stylesheet" type="text/css" href="/css/login.css" />
Although it is always a matter of personal preference, a lot of people create directories under their root directory for javascript, css, images, etc. -- so any static pages would be in /var/www/html, and assets are in subdirectories, such as /var/www/html/css, /var/www/html/javascript, /var/www/html/images, and so on.
In your static html pages (in /var/www/html), you can reference these using relative links, e.g. <link rel="stylesheet" href="css/style.css">, <script src="javascript/my-script.js"> or absolute links, e.g. <link rel="stylesheet" href="http://MY_IP/css/style.css">. For pages on your server but not in /var/www/html, using /css/style.css is the appropriate form of the relative link, as / is equivalent to the local directory /var/www/html (that is what setting DocumentRoot in Apache does), so /css accesses the local directory /var/www/html/css.
You can also use the <base> tag in the page head to set a base href for all your relative links:
<base href="http://MY_IP">
Then any relative links (e.g. href="css/style.css") will automatically be interpreted as (e.g.) http://MY_IP/css/style.css.
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]