Tag Info

New answers tagged

0

You Can solve this issue by following this. Alternatively: <system.webServer> <rewrite> <rules> <rule name="1" stopProcessing="true"> <match url="(trabajos)/(3ba2a9e4)/(some-cool-title)" /> <action type="Redirect" ...


0

You could add the following in your location: try_files $uri $uri/ index.php?open=$uri You still need to make sure that PHP files are passed to the fcgi process (or whatever you're using as PHP processor).


1

Nginx takes care of parameter behind the query string and store them in $args_ParameterName. So just use the location block like so: location = /index.php { rewrite ^ /$arg_open permanent; } location /fiction { ... } location /secondLink { ... } so on and so forth.


0

Convert comment to CW I got it working with RewriteEngine On RewriteCond %{REQUEST_URI} !^(.*)/dir1(.*)$ RewriteCond %{REQUEST_URI} !^(.*)/dir2(.*)$ RewriteRule (.*) - [R=404,L]


4

You don't. The web server is allowed to decode percent-encoded characters which don't decode to special characters before applying rewrite rules, and is allowed to decode the remainder of percent-encoded characters before passing the data to your web application. (See RFC 3986.) What you should be doing is applying the front controller pattern in your web ...


1

A few things: A rewrite should be used if you want to transfer to a different URL within the same site. The IIS rewrite module can change the requested url internally and it can be processed in the same existing request pipeline. A redirect is required when you want to transfer to a different site on the same server or a different server, which is your ...


0

You can use RewriteCond to match the last part of the domain name and then in your RewriteRule immediately following that, utilize that match in your path by using a %1 reference (note the percent sign, not a dollar sign, which refers to the most recently matched RewriteCond).


1

The rewrite and try_files apply only to incoming requests and the way the incoming URLs are mapped to paths on the server. There isn't a reliable way to rewrite the URLs that are in the actual HTML code that is sent to the clients. You should study other methods to make your apps prepend the required path into the URLs. Most often applications have a ...


0

Perhaps you forgot to include the all-important RewriteEngine On mod_rewrite won't change links inside the page. mod_substitute will... but you better make sure the content doesn't get compressed, as mod_substitute doesn't know to decompress it (you could use mod_header to remove any Accept-Encoding request header perhaps). I never had particularly good ...


0

Simply doing the following will not return a 404 header but a 200: server { ... error_page 404 /404page.html; ... location = /authreq.html { if ($allowed = 0){ return 404; } } } To invoke a 404 header and serve a custom 404 page without changing the browsers' addressbar address you should add '404' in the error_page directive ...


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;



Top 50 recent answers are included