w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Redirect multiple domains to one domain (with or without www before)
RewriteEngine on RewriteCond %{HTTP_HOST} ^domain.com RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=permanent,L] The ^domain.com solves the problem of the WWW, so all sub domains will now redirect. Make sure that http://www.newdomain.com is not included in the RewriteCond. That would cause a redirect loop More info

Categories : Htaccess

.htaccess redirect non-www to www but leave sub-domains
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^domain.com$ [NC] RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]

Categories : Htaccess

301 .htaccess redirect with other domains in web root
You have to declare which domains you want to redirect. Before you were saying all domains that were not example.com were redirected to new-example.com. RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(www.)?example1.com$ [OR] RewriteCond %{HTTP_HOST} ^(www.)?example2.com$ [OR] RewriteCond %{HTTP_HOST} ^(www.)?example3.com$ RewriteRule ^(.*)$ http://new-example.com/$1 [L,R=301]

Categories : Htaccess

RewriteCond is causing a redirect of alias to .in domains
There are several issues with the pattern matching, but the problem is likely in the line matching your international TLDs. Here is the issue on each line: The . is a wildcard so you are going to get a negative match on www.domain.com but also wwwxxx.domain.com with the * to match 0 or more of any character. The %{HTTP_HOST} should never be empty. The . is a wildcard for any character and you aren't exclusively matching the end of the %{HTTP_HOST} with $. Use the a ? to make the first pattern ungreedy. You don't need to match on co.in because it will be matched by in. I'm guessing that the [percent] in your example is really %, which is what it should be. Try the following in place of what you have now: RewriteCond %{HTTP_HOST} !^www. RewriteCond %{HTTP_HOST} ^(.*?).(ru|in|de|com.br|c

Categories : Regex

Why am I getting a 502 bad gateway when sending a redirect from behind amazon elastic load balancer?
It turns out that ELB is very picky about what it considers a 'valid' response and will return 502 Bad Gateway if it isn't happy. I fixed it by making sure the response from my server had the following headers: eg. if I was listening at http://example.com I send back the following response: HTTP/1.1 301 Moved Permanently Content-Type: */*; charset="UTF-8" Location: https://example.com/ Content-Length: 0 This makes ELB happy and everything works. For interest, here's the code (Java, using Simpleframework): private static void startHttpsRedirector() throws IOException { org.simpleframework.http.core.Container container = new org.simpleframework.http.core.Container() { @Override public void handle(Request request, Response response) { Path path = reques

Categories : Http

.htaccess redirect loop when trying to add forced HTTPS rule (Amazon Elastic Beanstalk)
You have L flag missing in few rules. Type changing your code to this: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / # Force HTTPS RewriteCond %{HTTPS} !=on RewriteCond %{ENV:BWC_ENV} ^prod$ RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # Parse the subdomain as a variable we can access in our scripts RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{QUERY_STRING} !^$ RewriteCond %{HTTP_HOST} !^www RewriteCond %{HTTP_HOST} ^([^.]+).[^.]+.[^.]+$ RewriteRule ^(.*)$ /$1?subdomain=%1 [L,QSA] # Ditto for the path; map all requests to /index.php RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !robots.txt RewriteRule ^(.*)$ /index.php?path=

Categories : Apache

Can a single hosts file entry contain multiple domains/sub-domains?
I found the solution. On IIS, I had to add https in bindings associating it to use IIS Development Certificate for SSL in my development environment. Also, in the process I found that both of the following wiil work for me. 127.0.0.1 somedomain.com, alternate-domain.com, subdomain.domain.com or 127.0.0.1 somedomain.com alternate-domain.com subdomain.domain.com Spaces and commas both work, and I can add multiple domains, subdomains combinations on same line. Also, if you are moving from a non-secure domain to secure domain/subdomain, SSL certificate needs to be setup on web server for it, else it would end up showing an error in the browser. Cheers!

Categories : Asp Net

mod rewrite: handling sub domains, top level domains and query string
You just need one rule as QUERY_STRING is automatically copied over to after redirect. RewriteCond %{HTTP_HOST} !^example.org$ [NC] RewriteRule ^ http://example.org%{REQUEST_URI} [R=301,L]

Categories : Htaccess

Elastic Beanstalk's Elastic Load Balancer name
Unfortunately the answer is no to the first 2. The last one, you are able to do it, but it more or less goes against the flow of Elastic beanstalk. You would need to create your own ELB with whatever name you like and then put it in front ot the instance that is created by beanstalk. You would need need to delete the ELB that beanstalk created so that it's not sitting there costing you money. I can't remember if beanstalk boots its environments via an AutoScaling group, but if it does, you'll need to associate that AutoScaling group with your new ELB. After creating and syncing all of that up, you need to point your CNAME to your new custom made ELB. That should work.

Categories : Amazon

Finalizing a Cursor that has not been deactivated or closed or database not closed error
When you are done with the cursor, you need to call Cursor.close(). Leaving it not closed leads to memory leaks. E.g.: Cursor cursor = null; try { cursor = getContentResolver().query(myUri, MY_PROJECTION, null, null, null); if (cursor != null && cursor.moveToFirst()) { // moar code } } finally { if (cursor != null) { cursor.close(); } }

Categories : Android

Application gets closed when terminal is closed, how to stop this?
Use nohup to prevent child processes from being killed when the terminal closes. spawn nohup /usr/bin/firefox https://www.google.com/ I assume there's more to the script, since there's no need to use Expect just to start firefox.

Categories : Python

Andriod-can i use in.myapp.app1 as package name instead of com.myapp.app1? because in domains are much cheaper than com domains?
I´m not sure what are you asking... Yes you can use whatever package name you want. When you create the new project modify the package name field. Like this: But when will you pay for the "domain"?? I am not understanding you...

Categories : Android

How to draw closed spline 3D (closed curve 3d) through unordered list of points3D. How to arrange points3D?
It sounds like you're looking for the Concave Hull of the data set. Unfortunately, I don't know of any pre-canned algorithms, but the link references a paper that another developer was starting from, as well as some sample code, so maybe that'll help you in the right direction.

Categories : C#

The underlying connection was closed: The connection was closed unexpectedly wcf service
The first thing i will do is, instead of returning the full list of candidates i will return an empty list. If that works fine, then it is very clear that the size of the data is a problem. To modify the size play with your binding parameters.

Categories : Wcf

"The underlying connection was closed: The connection was closed unexpectedly"
The first request does not utilize a header that indicates the length of the result. It closes the connection when it finishes. The second request utilizes the length header, reads the designated number of bytes, then closes the connection gracefully. (under the client side control instead of server driven disconnection) -or- The url you sent caused an error on the server. Is there an error in the server log or event viewer?

Categories : C#

Allow sub domains, but don't match www
You can add a ServerAlias before the VirtualDocumentRoot to catch the www. subdomain: ServerAlias www.* VirtualDocumentRoot /home/%-2.0.%-1.0/www The top example would catch all www. subdomains. To have the server behave as desired for all other subdomains, add another ServerAlias for all other subdomains like: ServerAlias * VirtualDocumentRoot /home/%-2.0.%-1.0/www/%-3.0 Hope this helps

Categories : Apache

Why is a "redirect" (that is, `return "redirect:/myPage"`) not working for my Tiles page definition?
Thanks to hints left by Sotirios' comments, I discovered that my inability to "redirect" to "myPage" had nothing whatever to do with Tiles. Rather, after a harder look, I realized that it was the configuration of the controller associated with "myPage". I had to add the following "public ModelAndView myPage(HttpSession session)" method to the Controller (see snippet, below), in order to perform a successful redirect (i.e., from another controller)...i.e., using return new ModelAndView("redirect:/myPage"); The problem was that the "myPage" controller did not contain an "public ModelAndView myPage(HttpSession session)" method...(thanks again, Sotirius). Below, is the "public ModelAndView myPage(HttpSession session)" method - code snippet) @Controller @Scope("session") @

Categories : Java

Redirect an URL by default, and show the original page when ?redirect=false is shown
Well... you actually need to test for that query parameter. something like: if ((Request.QueryString["redirect"] == null) || (Request.QueryString["redirect"] != 'false')) Response.Redirect("NEW URL"); } base.OnLoad(e); The test for null is there in case the redirect parameter wasn't passed in.

Categories : Asp Net

multiple domains to have different page_on_front
If you check out the $_SERVER reserved variable in PHP here you can use the indices to check the URL and build a condition on it. In your case $_SERVER['HTTP_HOST'] and $_SERVER['REQUEST_URI'] should do it. Example $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; // $url returns http://domain.name/path If you have different domains forwarding to the same site and you want them to redirect, you could condition it so that when the domain name in the address bar matches a specific rule, then redirect. if($_SERVER['HTTP_HOST']=='domainA.com') { // do something with domainA } elseif($_SERVER['HTTP_HOST']=='domainB.com') { // do something with domainB } else { // do something with anything else }

Categories : Wordpress

Same session_id() values for different sub domains in IE
did you try to specify session cookie domain validity? //for page1.php session_set_cookie_params(time()+3600, "/", "abc.example.com"); //for page2.php session_set_cookie_params(time()+3600, "/", "xyz.example.com"); from php.net for function session_set_cookie_params Set cookie parameters defined in the php.ini file. The effect of this function only lasts for the duration of the script. Thus, you need to call session_set_cookie_params() for every request and before session_start() is called. This function updates the runtime ini values of the corresponding PHP ini configuration keys which can be retrieved with the ini_get().

Categories : PHP

Magento and multiple domains
The apache virtual host setup is wrong. You need separate virtualhost entries for each domain as the following: <VirtualHost *:80> ServerAdmin webmaster@domain1.com DocumentRoot /var/www/http ServerName domain0.com </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@domain2.com DocumentRoot /var/www/http ServerName domain1.com </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@domain3.com DocumentRoot /var/www/http ServerName domai2.com </VirtualHost> And also the .htaccess file in your Magento root directory: SetEnvIf Host www.domain1.com MAGE_RUN_CODE=domain1_com SetEnvIf Host www.domain1.com MAGE_RUN_TYPE=website SetEnvIf Host ^domain1.com MAGE_RUN_CODE=domain1_com SetEnvIf Host ^domain1.com MAGE_RUN_

Categories : Apache

Using any/fake domains with ejabberd
Your initial problems (unable to access the server by using m.chat.com) were almost certainly DNS issues, and it seems you have isolated that down to the time taken to update the record. Your second question - about the fact that you can name virtual hosts without restriction, is simple but interesting. What makes you think there should be any kind of restriction? It would be like you dictating that I can't save "m.chat.com" in a file on my disk, or that I can't send "m.chat.com" in a message across the internet. This is why DNS exists and is structured the way it is. Although I can tell my server that it hosts facebook.com, nobody will connect to it because the DNS record for facebook.com does not point at my server (users generally don't set the "connect host" manually). Which begs the

Categories : Facebook

Liferay overriding other domains
I'm not sure which part of the situation is unclear for you. I assume that all content is served through Apache, but portalsite.com is just proxied by apache, then relayed to Liferay. Assuming your portal runs on tomcat or another appserver that supports "AJP", read about mod_jk and how to use it to relay traffic to your portal. You'll end up with a configuration for a virtual host that is somehow similar to this (pseudo-code-configuration, only typed here, never tested, beware the typos...) # external "workers" configuration file for mod_jk, defining # connection properties for JkWorkersFile /path/to/your/jk/configuration <VirtualHost *:80> ServerName portalsite.com # all content should be forwarded to tomcat... JkMount /* your_tomcat_worker # ...except

Categories : Apache

How many domains can be associated with an EC2 instance simultaneously?
The question isn't very clear but with just one ElasticIP you can host nearly infinite domain names to that IP. Then use Apache Virtuahosts, or IIS equivalent, to serve the websites. Just point the needed DNS records to the ElasticIP associated to the EC2 instance. There are many possible limitations to this, like storage, memory, SSL certificates on the same IP, etc.

Categories : Amazon

Nodejs: want to map domains to server
If you use something like node http-proxy or nginx you can run each of the separate sites on different local ports and then map the domain name back. I use the http proxy but others love nginx. For that to work, you'll need to add DNS entries resolving to the IP address that your reverse proxy is running on. Then for example, the port 80 request will get mapped back to localhost:3000. This allows for each app to run in isolation and in separate processes from the other sites. They can't crash each other. You also don't have namespace issues where both apps claim the same path. My app.js for the http proxy looks like this: var proxyPort = 80; var http = require('http'); var httpProxy = require('http-proxy'); var options = { router: { 'localhost': '127.0.0.1:3000',

Categories : Node Js

Pow domains not loading in Chrome
Thanks to user Dan Reedy (see above) I was able to fix this by moving from OpenDNS to the Google DNS 8.8.8.8 and 8.8.4.4 settings. Now, pages load faster and Pow servers are working again. And they seem to actually load much faster. Awesome!

Categories : Ruby On Rails

Heroku with Multiple Domains
Before pushing Try this:- $ git remote add heroku git@heroku.com:yourappname.git ( to add current stack ) $ heroku keys:add ~/.ssh/id_rsa.pub (if stuck with key then add local machine key to heroku) $ git commit -m "message" $ git push heroku master <branch name>

Categories : Ruby On Rails

jQuery: Set cookie for two domains
Well, if you want to extend it to the domain and not only a specific subdomain, just use domain : 'mydomain.com' instead of : domain: 'sub.mydomain.com'

Categories : Javascript

How do I break out of an iFrame only for certain domains?
You can use another condition... var allowedDomains = ["stackoverflow.com"]; if (allowedDomains.indexOf(top.location.hostname) == -1 && top.location!= self.location) { top.location = self.location.href }

Categories : Javascript

My website showing on two domains
I see you have put php tag so I would suggest something like this: if ($_SERVER['HTTP_HOST'] != 'rtc') { exit; } However its better to handle this kind of things in your http server settings. For example Apache has virtual named hosts.

Categories : PHP

MAC OSX: Cannot run multiple local domains
I stumbled across this same problem... In your httpd-vhosts.conf file (/private/etc/apache2/extra/httpd-vhosts.conf after showing hidden files) add the following for each domain... <VirtualHost *:80> ServerName mysubdomain.dev CustomLog "/root/to/site/logs/mysubdomain.dev-access_log" combined ErrorLog "/root/to/site/logs/mysubdomain.dev-error_log" DocumentRoot "/root/to/site/mysubdomain.co.uk" <Directory "/root/to/site/mysubdomain.co.uk"> DirectoryIndex index.php Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny allow from all </Directory> </VirtualHost> Then restart apache. Everything else you have seems to be the same as my setup. Make sure you have the correct permissi

Categories : Osx

Use cakephp session with two different domains
You need to connect to the first website's database and compare user session with user cookies. $db = new mysqli("localhost", "user", "pass", "db"); $id = $db->escape_string($_COOKIE["id"]); $session = $db->escape_string($_COOKIE["session"]); $check = $db->query("SELECT data FROM cake_sessions WHERE id = '" . $db->real_escape_string($id) . "'"); $checkarr = $check->fetch_assoc(); if($session == $checkarr["data"]) echo "logged"; not tested; also I'm not sure about cakephp authcookes, so they're probably wrong.

Categories : PHP

php copy() on same server different domains
Try editting your /var/www/vhosts/domain1.com/conf/vhost.conf file. If it doesn't exist, create it. Then add the following line: php_admin_value open_basedir "/var/www/vhosts/domain1.com/httpdocs:/var/www/vhosts/domain2.com/httpdocs" Save the file and then reload your apache configuration by running this command on the command line assuming you have priviledges: /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=domain1.com

Categories : PHP

Codeigniter: One site, two domains
In DB config file write a condition like this if(strpos($your_current_url, 'domain1') !== FALSE) : /* * DB CONFIG FOR DOMAIN1 */ elseif(strpos($your_current_url, 'domain2') !== FALSE) : /* * DB CONFIG FOR DOMAIN2 */ endif;

Categories : PHP

CakePHP $this->redirect($this->Auth->redirectUrl()); Duplicates BaseURL in Redirect
The issue is with line 680 of lib/Cake/Controller/Component/AuthComponent.php return Router::url($redir); Changing it to the following (which was an update in 2.3.9) fixes it: return Router::url($redir + array('base' => false)); As does changing it to this (which is an update in 2.4): return Router::normalize($redir, false); See commit message here: https://github.com/cakephp/cakephp/commit/8133f72 Obviously editing the CakePHP core files isn't a good idea, so I upgraded to 2.3.9 to fix the issue.

Categories : PHP

Joomla $app->redirect() in template index.php causing a redirect loop
This is occurring because $domain != $primary is failing. The way that you get $domain maybe is the root of cause. Look at PHP $_SERVER['HTTP_HOST'] vs. $_SERVER['SERVER_NAME'], am I understanding the man pages correctly? and be sure that is not this the problem. Also, Joomla have JUri package that help with this. If you are working with Joomla, is a good idea use it.

Categories : Joomla

(SOLVED!) How to check javascript across domains?
myVersion1 is a function, so it does not equal "1.0". You have two functions, both are doing the same thing. They both set window.domain2_version="1.0". You might want your function to return a value, or else you could compare two different global variables.

Categories : Javascript

Dynamic multiple domains in one project
One of possible solutions: Client's domain - hosted on your server. Each client's domain is linked to directory - where your php application is placed. Your application shows content depending on $_SERVER["HTTP_HOST"] value - which returns domain of your application (this would be in your case http://www.myclientdomain.com)

Categories : PHP

S3 file hosting sub-directory with domains
Not presently, due to some important details about S3: You can do a 1:1 mapping between a CNAME and a bucket, because buckets are DNS-addressable. S3 does not have folders. S3 is a flat hierarchy of files inside of a bucket. Filenames allow / characters in them. Many UIs for S3 display these as folders, but that's a made-up concept.

Categories : Amazon

How to reverse IP to domain and get domains on the same server ?
Simplest way is to use that function: http://php.net/manual/en/function.gethostbyaddr.php To get something more you probably should play with functions like "system" and unix tools like "host" command and parse thier output. Or directly query the DNS - you can read here more about it: http://en.wikipedia.org/wiki/Reverse_DNS_lookup - basically you're doing a query for domain that looks like this: 5.2.0.192.in-addr.arpa where 5.2.0.192 should be replaced with address you're intrested in.

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.