.htaccess

.htaccess Resource interpreted as Script but transferred with MIME type text/html

爱⌒轻易说出口 提交于 2020-01-02 07:16:26
问题 I've a big problem after I add this line into my htaccess: RewriteRule ([a-z]+)/ index.php?p=$1 [L] I have error like that: Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/media/css/lvnr.min.css". Resource interpreted as Script but transferred with MIME type text/html: "http://localhost/media/js/bootstrap.min.js". I think that the problem is that my htaccess try to redirect all the link media/... to index.php?p= ... So how to fix it please 回答1:

nginx basic authentication on all pages except a specific URL and it's follow

霸气de小男生 提交于 2020-01-02 07:14:40
问题 Am implementing basic authentication on my Ubuntu server. I want to except url and all it follows. example, the url i want to except is sample.com/sample/ and all of it follows like sample.com/sample/1, sample.com/sample/2, sample.com/sample/samdsFFGRwd12, sample.com/sample/FHFEdsa1g65 How to make this possible? 回答1: To exclude URL from the basic authentication of nginx, need to add in your nginx conf something like: location /sample/ { auth_basic off; } 来源: https://stackoverflow.com

htaccess redirect index.html to index.php for domain root only

无人久伴 提交于 2020-01-02 07:01:07
问题 I have a htaccess rule which redirects the index.html to index.php RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/ RewriteRule ^(.*)index\.html$ /$1index.php [R=301,L] This works fine - when I call http://mydomainname.com/index.html , it redirects me to http://mydomainname.com/index.php but I got one problem, when there is a file in subfolder named index.html then my htaccess rule takes that to index.php. Example - http://mydomainname.com/subfolder/index.html to http:/

htaccess add www if not subdomain, if subdomain remove www

纵然是瞬间 提交于 2020-01-02 06:32:22
问题 I'm trying to make this - probably example would be the best, so: domain.com -> www.domain.com www.domain.com -> www.domain.com subdomain.domain.com -> subdomain.domain.com www.subdomain.domain.com -> subdomain.domain.com So if visitor is in subdomain, don't add www and when is set, remove It. Else if not in subdomain, add www. I tried to write something like this, but this doesn't remove www from subdomain adress :/ Also, if possible, I don't want to use domain and TLD domains but make it as

htaccess add www if not subdomain, if subdomain remove www

為{幸葍}努か 提交于 2020-01-02 06:31:08
问题 I'm trying to make this - probably example would be the best, so: domain.com -> www.domain.com www.domain.com -> www.domain.com subdomain.domain.com -> subdomain.domain.com www.subdomain.domain.com -> subdomain.domain.com So if visitor is in subdomain, don't add www and when is set, remove It. Else if not in subdomain, add www. I tried to write something like this, but this doesn't remove www from subdomain adress :/ Also, if possible, I don't want to use domain and TLD domains but make it as

Phalcon tutorial error PhalconException: TestController handler class cannot be loaded

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-02 05:32:27
问题 I'm having some trouble getting Phalcon Tutorial 1 to work. In the end I've cloned the version of it on Github to make sure I'm not missing something; still getting the same behavior from that. Pointing the browser to localhost/test as shown in the tutorial gives: ` "PhalconException: TestController handler class cannot be loaded". Going to localhost/test.php , however, loads the "Hello!" test message correctly. Phalcon is shown in phpinfo() and get_loaded_extensions() . I get this behaviour

Trailing slash causes 404, can I fix using htaccess?

坚强是说给别人听的谎言 提交于 2020-01-02 04:48:15
问题 The offending URLs are: (Doesn't work) http://alltheragefaces.com/face/surprised-wut/ (Works) http://alltheragefaces.com/face/surprised-wut The .htaccess rule I have for these types of URLs looks like: RewriteRule ^face/(.*)$ face.php?term=$1 What can I do to make both of these URLs to go to the same page? 回答1: You can use this: RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ /$1 [L,R=301] The first line says: "if it's not a directory" (because then a trailing slash would have meaning

Apache mod_rewrite ending periods

旧时模样 提交于 2020-01-01 19:03:05
问题 I am trying to better understand Apache's mod_rewrite, and am having unexpected results. I've tried many different expressions, but nothing seems to behave how I understand it should. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ index.php?route=$1 [QSA,L] Using www.domain.com/item1/item2/item3 yields item1/item2/item3 Using www.domain.com/item1/item2/item3.php yields item1/item2/item3.php Using

How to handle mod-rewrite with a custom url scheme?

不问归期 提交于 2020-01-01 19:01:13
问题 So here's my problem : I'm trying to do a redirection on a webpage with the htaccess file. This redirection will be towards a custom URL (i.e not something ike "http://..." but something like "myurl://...). For now, I'm trying this on a little local apache server, in which I have a index.html page, a "test" directory and in this directory a .htaccess file and a test.html file. Here's what's inside the .htaccess file : Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^(.*)$

mod_rewrite: Redirect request to subdir with many subfolders of different structures + redirect to index.php

一世执手 提交于 2020-01-01 16:32:25
问题 I need to create a following rule to place in my .htaccess For each request i'd like to execute file/path in subfolder subdir. If the file doesn't exist there then i'd like to forward this request to index.php Let say that .htaccess iw placed at http://domain/folder When the user opens url http://domain/folder/Subfolder/xxx.html he should recieve file from http://domain/folder/subdir/Subfolder/xxx.html So these rules have to consider the fact that there are subfolders inside subdir.