Tag Info

New answers tagged

0

Maybe I just figured it out? I added ngx.redirect("/"); So I have a / with location /public/html/ in my nginx.conf and also a: location /lua { default_type text/plain; content_by_lua ' os.execute("/myscript.sh") return ngx.redirect("/")'; I would have preferred to just one 'location' instead of using redirect like that but at least I ...


1

I would approach this by making a script that makes symlinks to all those files to the directory where you want the files to be visible. Then you could use something like lsyncd to monitor the directories and automatically generate symlinks whenever new files appear or existing files change.


1

One issue here is at least that you are using the internal keyword inside the location. This means that it will match only requests coming from inside nginx, for example from other location blocks. You should remove that keyword. Your regexes need also other fixes. Try this location block: location ~ \.(gif|jpg|png)$ { rewrite ...


0

Install Apache and create virtual host like the following in path\to\apache\conf\extra\httpd-vhosts.conf: <VirtualHost *:80> DocumentRoot C:/Apache/htdocs ServerName anyname.net # Other directives here </VirtualHost> Then in the document root specified in the above setting, create an index.html file with an offline message. The ...


0

Maybe you need to re-read the doc as it's explained here : Syntax: rewrite regex replacement [flag]; Default: — Context: server, location, if [ ... ] An optional flag parameter can be one of: last stops processing the current set of ngx_http_rewrite_module directives and starts a search for a new location matching the changed URI; ...


0

Try something like: location ~* /staging/(.*) { rewrite ^/staging/(.*)/$ /staging/$1/index.php break; } or to limit to one level: location ~* /staging/(*) { rewrite ^/staging/([^/]*)/$ /staging/$1/index.php break; }


0

For others looking on this replace: location ^~ /api { rewrite ^/(.*)$ public/index.php?_url=/$1; } with rewrite ^/api(/.*)$ /api/public/index.php?_url=$1 last;


1

The rewrite directive regex will match the normalized request URI while the server_name directive will match the domain name. The last flag will force an internal redirect and that's not what you want. So you are doing it the wrong way. Use this instead : server { listen 80; server_name "~^(?<subdomain>[^.]*)\.?cervo02.com$"; return 301 ...


3

Ok, solution by myself: Add file with pcre: virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf, pcre:/etc/postfix/virtual_alias_maps.cf In file: /^admin@(.*)/ admin@$1,webmaster@$1 Reload, done.


0

If it is possible for you to install IIS URL Rewrite Module on the machine then this can be done by combination of using regex and url rewrite/redirect. http://www.iis.net/downloads/microsoft/url-rewrite


0

Try This <configuration> <system.webServer> <rewrite> <rules> <rule name="removePort" stopProcessing="true"> <match url="^(http(s)?://)?(portal\.company\.com):7500(/.*)?$" /> <action type="Redirect" url="https://{R:3}/{R:4}" /> </rule> ...


1

It has been 3 years since this question was asked and a lot has changed. This answer is to help anyone like me. The current version of nginx allows to create multiple sub filter rules under one location directive. Like so location / { proxy_pass http://original-domain.com; proxy_set_header Accept-Encoding ""; proxy_set_header original-domain.com; ...


0

You can accomplish this with the following condition: RewriteCond %{REQUEST_URI} ^/video/player/sources.json$ RewriteCond %{QUERY_STRING} !="" RewriteRule . - [E=crossdomain:1] YMMV and may require some tweaks to work with another rules, but this is the way.


0

The directive is probably superfluous since websvn has its own file where things are put into place. On my machine (Ubuntu 12.04) it's this file /etc/websvn/apache.conf The contents probably need some editing. It looks like this: # Configuration for websvn using php4. Alias /websvn /usr/share/websvn <Directory /usr/share/websvn> ## No ...


0

Figured it out: location ^~ /cdn { rewrite "^/cdn/[0-9]{1,6}/(.*)$" /$1 break; }


0

I'm not positive, but think your problem is right at the beginning of your location block: location /cdn I think if you try something like this: location ^/cdn/(.*) you'll get the desired effect.


-1

You can do it with WordPress rewrite API that can convert URLs from somewhat programmatically well-located to users. Read this article can be helpful to rewrite rule for custom parameter - http://clivern.com/how-to-add-custom-rewrite-rules-in-wordpress/


2

You should use another server block for the redirect. server { server_name *.domain.tld; listen 100.10.10.1; location /personal { rewrite ^ http://domain.tld/personal permanent; } } And then you should remove the location block from the other server block, and remove *.domain.tld from the server_name directive.


1

RewriteRule ^(cp_contactformtoemail_captcha.*image.jpg) /INDEX.PHP/$1


0

For a site using plain vanilla cPanel-based shared hosting (Apache 2.2), I solved what appears to be the same problem by adding a file named "401.shtml" to the document root (public_html). The mere existence of the file, without even an ErrorDocument 401 directive in the .htaccess, solved the problem.



Top 50 recent answers are included