subdomain

Dynamic subdomains + defined subdomains via htaccess

ぐ巨炮叔叔 提交于 2019-12-10 11:54:27
问题 I hate asking questions about mod_rewrite, but I can't seem to get these rules working properly. I had it setup and figured out once before, but a few years have passed and now it's just not playing nice and my mod_rewrite knowledge is back to uhhhh...... Essentially what I want to do is force www on the main domain, example.com. (or forcing no www would be even better, but I haven't remotely been able to get that working properly along with dynamic subdomains). If my.example.com rules exist,

How to create subdomain for each language?

青春壹個敷衍的年華 提交于 2019-12-10 10:35:43
问题 I want to make website in multiple languages, I do it right with cookies to detect the user preferred language. Now I want to make each language has its sub-domain to be indexed in search engines, some thing like Facebook. so I want to configure my Apache to point all my virtual hosts to the same folder, then use $_SERVER["SERVER_NAME"] to figure out what sub-domain was requested. I start to use this code in my htaccess file: <VirtualHost *> ServerName mydomain.com ServerAlias en.mydomain.com

Apache RewriteCond (subdomain)

北城余情 提交于 2019-12-10 10:14:40
问题 I am trying to redirect request for a subdomain to main domain. ie: xxx.domain.com/blah/xyz --> domain.com/blah/xyz My rewriteconds work fine for xxx.domain.com but for anything like xxx.domain.com/123/xyz 400 Bad Request is all I get… Any help will be appreciated. 回答1: Rule should look like : RewriteCond %{HTTP_HOST} ^xxx.domain.com RewriteRule (.*) http://domain.com/$1 [L] 来源: https://stackoverflow.com/questions/5641715/apache-rewritecond-subdomain

Regular expression for valid subdomain in Ruby

こ雲淡風輕ζ 提交于 2019-12-10 02:39:52
问题 I'm attempting to validate a string of user input that will be used as a subdomain. The rules are as follows: Between 1 and 63 characters in length (I take 63 from the number of characters Google Chrome appears to allow in a subdomain, not sure if it's actually a server directive. If you have better advice on valid max length, I'm interested in hearing it) May contain a-zA-Z0-9, hyphen, underscore May not begin or end with a hyphen or underscore EDIT: From input below, I've added the

Deploy Django REST API to api.example.com: Apache 2.2, mod_wsgi and mod_rewrite

我与影子孤独终老i 提交于 2019-12-09 22:59:06
问题 I have been searching for information on this topic for a couple days and I keep running into road blocks. I have a Django web site and application running at www.example.com and I'm forcing HTTPS. It's deployed on Apache 2.2 with WSGI. This works fine and works for both example.com and www.example.com . I also have a REST API ( pip install djangorestframework ) running at https://www.example.com/api/v1/ . This also works fine. I want to run the API from a subdomain https://api.example.com

Get Visual Studios to use subdomain?

走远了吗. 提交于 2019-12-09 17:54:07
问题 While writing an asp.net project i may have this url for testing/debugging http://localhost:1234/ I have code that takes in account of subdomains. Can i make visual studios call the same code with http://anysub.localhost:1234/ 回答1: You can update your hosts file and put in any subdomin for the localhost: 127.0.0.1 example.com 127.0.0.1 sub.example.com You can then point your browser to either domain. So long as the debugger is attached to IIS/Dev browser, you will be able debug your server

Rails 4 Session across subdomains

吃可爱长大的小学妹 提交于 2019-12-09 16:23:54
问题 I'm trying the following with no luck in an attempt to persist sessions across subdomains: MyApp::Application.config.session_store :cookie_store, key: '_myapp_session', :domain => :all, :tld_length => 2 MyApp::Application.config.session_store :cookie_store, key: '_myapp_session', :domain => 'myapp.dev' MyApp::Application.config.session_store :cookie_store, key: '_myapp_session', :domain => '.myapp.dev' I found all of these combinations on Google and SO. I saw a few explanations but it

Get second level domain name from URL

自作多情 提交于 2019-12-09 09:37:33
问题 Is there a way to get top level domain name from the url for e.g., "https://images.google.com/blah" => "google" I found this: var domain = new URL(pageUrl).hostname; but it gives me "images.google.com" instead of just google. Unit tests I have are: https://images.google.com => google https://www.google.com/blah => google https://www.google.co.uk/blah => google https://www.images.google.com/blah => google 回答1: You could do this: location.hostname.split('.').pop() EDIT Saw the change to your

Auth::user() doesn't travel across subdomains? - Laravel 5.2

柔情痞子 提交于 2019-12-09 06:50:54
问题 I have a subdomain in my site, for example: http://example.ca http://blog.example.ca The blog one is only accessible to people who have the url, that is, its not public or common knowledge. I have a bunch of routes related to this domain that requires you to be logged in. I have stated in a nav.blade.php that if the user is logged in, there should be a drop down and if not then there should not be a drop down. this all works for http://blog.example.ca but when I go to http://example.ca I am

subdomain rewriting in ASP.NET?

*爱你&永不变心* 提交于 2019-12-09 01:21:16
问题 How do i do this in .NET? http://why.does.my.head.asplode.net/ I want to do something like ytmnd where each url is a different user generated page. I might need something as simple as pointing to a directory so dirname.mysite.com will redirect to http_public/userGenContent/dirname/ 回答1: HAHA ... I handled the Begin request event in global.aspx for this because my urls come from sql server. Why are so many people sub domain crazy these days? in Begin Request you can do something like this (not