Tag Info

New answers tagged

0

Now example.com/store/my-funny-test-product.html works but CSS images and the like are broken! Use try files Requests for css files (or, any actual files in /var/www/example.com/public_html/store) aren't working at the moment because the requeset is routed unconditionally to /store/index.php. The minimal change necessary to make that work - is to use ...


0

From what I see your nginx doesn't listen the 433/ssl. Your config misses the actual http to https redirection. Using ip addresses in server_name is a nonsense. You should create two server {} statements, one for port 80 and the other for ssl; and redirect from first to second. Your config contains traces of such tries; I don't understand why you commented ...


1

You need to have something like this RewriteEngine On Options +FollowSymLinks RewriteRule ^article/([a-z0-9-/]+).html$ article.php?url=$1 [NC,L] RewriteRule ^produs/([a-z0-9-/]+).html$ produs.php?urlprodus=$1 [NC,L] So rewrite matches are different; now you would be able to make rewrite from say www.domain.tld/article/myRewriteRule.html to ...


1

The magic happens here: try_files $uri $uri/ /index.php?q=$request_uri; This means that nginx checks first if the requested file or directory exists on the filesystem. If a file does not exist, it passes the request to Joomla, and passing the original URI to the q parameter.


0

As far as I know you cannot use RewriteRule in .htaccess files to go out of your DocumentRoot, because this DocumentRoot will always be added at the beginning of the rewritten url. I would advise to put each app in a separate folder under your DocumentRoot. For example, use DocRoot/wordpress and DocRoot/other. Now if you want nice urls like ...


2

I think what you want is Alias /other-system /httpdocs/other-system See Alias. In .htaccess, instead you can use RewriteEngine on RewriteRule ^/other-system/(.*) /httpdocs/other-system/$1 [QSA]


2

posted answers from OP comment The problem was caused by HSTS header. In main domain, there is entry includeSubDomains in HSTS header . If a browser visits main domain and receive that HSTS header, the browser will force to connect via HTTPS in main domain and subdomain too. So, its pretty clear that nginx doesn't cause the redirection. If you don't want ...


0

First of all: my pet peeve, quoted from from the manual on .htaccess files: You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same ...


0

The documentation for Alias shows that this is the expected behavior. Alias appends any trailing paths after the aliased path. I think what you want is to throw away the additional path information in the alias, by AliasMatch /(admin|client)/.* /var/www/project That should send the request to /var/www/project, while leaving the URL path of the original ...


0

Redirect /a/ http://other.com/a/ See the Apache manual for Redirect.


0

You can use the following regex pattern to match only requests where the path part of the URI is empty: ^$ Put it into the "Match URL" field Use a Condition to make sure it only applies to requests for the sub.foo.com domain by matching on the {HTTP_HOST} server variable. Pattern should be something like ^sub\.foo\.com$


0

Have you reviewed your config.php in moodle after the SSL switch? Note that your $CFG->wwwroot now has changed. It should be https://students.example.com


0

1. Handling arguments Despite what Tero Kilkanen says, nginx is perfectly capable of handling arguments: this is done by using the args and arg_ variables from the core module. 2. rewrite context As Glueon pointed out, rewrite is usable in server, location and if contexts, as the documentation states. if is to be avoided at all costs, so I won't be going ...


0

Assuming your requests look like http://localhost/kuimbi/*, you misconfigured the server_name. It must not contain URI, just domain names. So your configuration should look like this instead : server { listen 127.0.0.1:80; server_name localhost; root www/kuimbi; location ~ ^/kuimbi/(.*)$ { try_files /www/kuimbi/$1 ...


0

It looks like you are trying to host example.com and students.example.com on the same IP address. This is fine if you are use regular HTTP, but if you are using HTTPS (Port 443), then you need to serve this up on a different IP address. <VirtualHost *:80> DocumentRoot /var/www/example.com ServerName example.com </VirtualHost> ...


1

Okay, so I found the solution: if ($prerender = 1) { rewrite .* /api/ last; } and in /api/ I have a PHP framework backend, where I have a route matching ?_escaped_fragment_=/... and I can do with it whatever I want.


0

I suspect you may have another issue. An HTTP request looks something like: GET /foo.php HTTP/1.1 Host: monkedung.example.com Keep-Alive: timeout=15 Connection: Keep-Alive etc. When you encrypt it with SSL, everything after the GET line is encrypted, so Apache has no way of even knowing what host you are asking for. Without knowing the host, it has no ...


2

You can try Apache rewrite rules as below. RewriteEngine On RewriteCond %{REQUEST_URI} !(import\/batch_name1|import\/batch_name2|import\/batch_name3) [NC] RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,QSA]


0

Ok, I finally get it working by removing IsapiFilterModule and IsapiModule from the site.


0

File /etc/nginx/vhosts/*.example.com After that code server_name *.ilanimo.com; Add this code if ($host ~* (.*)\.example\.com) { set $sub $1; rewrite ^(.*)$ /index.php?page=store&storeid=$sub&subdomain=$1 break; } Restart nginx /etc/init.d/nginx restart


2

Wouldn't the error_page directive do this for you you? For example something like this: server { ... error_page 404 /404page.html; ... location = /authreq.html { if ($allowed = 0){ return 404; } } }


1

The problem is that when you add the second match, to catch the filename ending, you are forgetting to attach that match to the rewrite. The first parenthesis $1, which you're adding on the rewrite side, but that one no longer contains the .gif, .jpg etc because they are outside the parenthesis. Instead, they end up in $2. So try rewriting the rules to ...



Top 50 recent answers are included