.htaccess

How to add subdomain in .htaccess and force WWW in url

Deadly 提交于 2020-01-15 11:51:14
问题 I have the following code to force WWW in url rewriteCond %{HTTP_HOST} !^www.example.com [NC] rewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] I want to add a subdomain max.example and refer to www.example.com/update/max directory If I do not add any rule, max.example.com will redirect to www.example.com/update/max . If I remove force WWW in url it works. But I still need force WWW in url. How to write the rule? Thanks! 回答1: Change your rule to this: RewriteCond %{HTTP_HOST} !^(www|max)

.htaccess replace part of URL

ⅰ亾dé卋堺 提交于 2020-01-15 11:25:09
问题 Anyone here knows how to do this on .htaccess? I need to replace the part of URL that is inside the "[]". Here is the URL: [http://example.com/site/second/files/] 2012/08/Image.jpg with this new URL: [http://example-two.com/media1/] 2012/08/Image.jpg Thanks in advance! 回答1: RewriteRule ^site/second/files/(.*)$ http://example-two.com/media1/$1 [L] 回答2: You could also use mod_alias: Redirect 301 /site/second/files http://example-two.com/media1/ 来源: https://stackoverflow.com/questions/11963402

Htaccess rewrite to index.html or admin.html

大憨熊 提交于 2020-01-15 11:13:13
问题 I use the routing module of AngularJS for my WebApp and it works great. But I want that when the user reload a page like /Category/1 , he will be redirected to index.html with /Category/1 as parameters. This is working. But when I want to add an admin interface, it brokes... Here is my folder : index.html admin.html Some angularjs folders... And my .htaccess file : <IfModule mod_rewrite.c> # Redirect /index.html to / RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html RewriteRule ^index

Rewrite all files from newfolder to index.html

吃可爱长大的小学妹 提交于 2020-01-15 11:03:14
问题 I have this code: RewriteEngine On RewriteBase / RewriteCond %{HTTP_USER_AGENT} (mozilla|navigator|chrome) [NC] RewriteRule ^/newfolder/(.+) /index.html/$1 [L,NC] I want all files from newfolder (located in public_html) to be rewrite to index.html which is in public_html, ofcourse. Any help please... 回答1: Remove leading slash from your regex to match URI: RewriteEngine On RewriteBase / RewriteCond %{HTTP_USER_AGENT} (mozilla|navigator|chrome) [NC] RewriteRule ^newfolder(/|$) /index.html [L,NC

Query string breaking page

筅森魡賤 提交于 2020-01-15 10:31:25
问题 A Google Analytics query string on an incoming link breaks the display of my site. Does anyone know why the following would cause my site to fail to load its homepage properly (it appears to prevent the loading of some plugins that the page needs) http://mysite.com/?utm_medium=email While this does not: http://mysite.com/#utm_medium=email And if you know why, how do I fix this? I have incoming links that use the query string method and they are all resulting in the visitor seeing a broken

how can I Redirect all requests to https and non-www in one jump?

旧时模样 提交于 2020-01-15 10:16:09
问题 I want to redirect all requests to https and non-www in one jump for main/ home page and other sub pages. I am using the following htaccess. source RewriteEngine On RewriteBase / RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^mytesting\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.mytesting\.com$ RewriteRule .* https://www.mytesting.com%{REQUEST_URI} [R=301,L] But I got the following redirection I want like this: http://mytesting.com > https://mytesting.com http://www.mytesting.com > https:/

how can I Redirect all requests to https and non-www in one jump?

拟墨画扇 提交于 2020-01-15 10:14:19
问题 I want to redirect all requests to https and non-www in one jump for main/ home page and other sub pages. I am using the following htaccess. source RewriteEngine On RewriteBase / RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^mytesting\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.mytesting\.com$ RewriteRule .* https://www.mytesting.com%{REQUEST_URI} [R=301,L] But I got the following redirection I want like this: http://mytesting.com > https://mytesting.com http://www.mytesting.com > https:/

.HTACCESS url rewrite - 4 simple rewrite rules are not working (GoDaddy+WordPress)

不想你离开。 提交于 2020-01-15 09:54:09
问题 I wonder if my rewrite rules are incorrect since they are not working on my Godaddy shared server? I have four very basic .htaccess URL rewrite rules. Whenever the user types/clicks on the link: Beautiful SEO (desired) link http://www.electriccarlos.com/albums/ is actually http://www.electriccarlos.com/type/audio/ Beautiful SEO (desired) link http://www.electriccarlos.com/discography/ is actually http://www.electriccarlos.com/type/audio/ Beautiful SEO (desired) link http://www.electriccarlos

Redirect wildcard subdomain without known domain - htaccess

六月ゝ 毕业季﹏ 提交于 2020-01-15 09:41:29
问题 What is the appropriate way to redirect via htaccess when a top level domain name is not known? My specific situation is this... Our company has a custom content management system that is used on several of our servers. Each server had a subdomain for each of our customers on that server. i.e. customerBob.exampleA.com customerLarry.exampleA.com customerJudy.exampleB.com customerAlice.exampleB.com We have many servers, each one hosting a group of customers. The subdomains were completely

SSL Subdomain redirects to Original Domain

给你一囗甜甜゛ 提交于 2020-01-15 09:29:55
问题 I have a domain.com (main domain), works perfectly with https://domain.com I also have a Subdomain store.domain.com. It works good only with HTTP, such as http://store.domain.com. When I add HTTPS to subdomain, it automatically redirects to Main domain. Such as https//:store.domain.com --->redirects--> https://domain.com I have a Wildcard SSL for domain.com Any help how to make https//:store.domain.com work properly with HTTPS without being redirected to main domain ? 来源: https:/