Search Results

Search found 4313 results on 173 pages for 'mod rewrite'.

Page 6/173 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • nginx: Rewrite PHP does not work

    - by Ton Hoekstra
    I've a Suffix Proxy installed and I'm using the following rewrite with wildcard subdomain DNS on: location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php last; break; } } My suffix proxy has the following URL format: (subdomain and/or domain + domain extension to proxy).proxy.org/(request-uri to proxy) I've this php code in my index.php: if(preg_match('#([\w\.-]+)\.example\.com(.+)#', $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'], $match)) { header('Location: http://example.com/browse.php?u=http://'.$match[1].$match[2]); die; } But when requested a page with a .php extension I'll get a 404 not found error: http://www.php.net.proxy.org/docs.php - HTTP/1.1 404 Not Found http://www.utexas.edu.proxy.org/learn/php/ex3.php - HTTP/1.1 404 Not Found But everything else is working (also index.php is working): http://php.net.proxy.org/index.php - HTTP/1.1 200 OK http://www.php-scripts.com.proxy.org/php_diary/example2.php3 - HTTP/1.1 200 OK http://www.utexas.edu.proxy.org/learn/php/ex3.phps - HTTP/1.1 200 OK http://www.w3schools.com.proxy.org/html/default.asp - HTTP/1.1 200 OK Somebody has an answer? I don't know why it's not working, on apache it's working fine. Thanks in advance. I've removed the location and now it's working perfectly: if (!-e $request_filename) { rewrite ^(.*)$ /index.php last; break; }

    Read the article

  • Ngix rewrite is not working as expected

    - by SamFisher83
    I am trying to learn how to use nginx and how to use its rewrite functionality Nginx seems to be doing the rewrite: 2012/03/27 16:30:26 [notice] 16216#0: *3 "foo.php" matches "/foo.php", client: 61.90.22.223, server: localhost, request: "GET /foo.php HTTP/1.1", host: "domain.com" 2012/03/27 16:30:26 [notice] 16216#0: *3 rewritten data: "img.php", args: "", client: 61.90.22.223, server: localhost, request: "GET /foo.php HTTP/1.1", host: "domain.com" but in my access log I am getting the following: 61.90.22.223 - - [27/Mar/2012:16:26:54 +0000] "GET /foo.php HTTP/1.1" 404 31 "-" "Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20100101 Firefox/11.0" 61.90.22.223 - - [27/Mar/2012:16:30:26 +0000] "GET /foo.php HTTP/1.1" 404 31 "-" "Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20100101 Firefox/11.0" There is an img.php in the root directory so I am not sure why I am getting a 404 error Here is part of the configuration block: rewrite foo.php img.php last; location / { try_files $uri $uri/ /index.html; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; }

    Read the article

  • Double request from mod-rewrite

    - by Dave
    I've written a module that sets Apache environment variables to be used by mod-rewrite. It hooks into ap_hook_post_read_request() and that works fine, but if mod-rewrite matches a RewriteRule then it makes a second call to my request handler with the rewritten URL. This looks like a new request to me in that the environment variables are no longer set and therefore I have to execute my (expensive) code twice for each hit. What am I doing wrong, or is there a work around for this? Thanks

    Read the article

  • Mod Rewirte Question.

    - by delimit
    I cant seem to get Example 1 to turn into Example 2 using mod rewrite. Can someone help me out? Example 1 http://www.example.com/info/index.php?uid=123 Example 2 http://www.example.com/123 Mod rewrite code. Options +FollowSymLinks Options -Indexes RewriteEngine on RewriteBase /info RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/info/$1 [R=301,L] RewriteRule ^([^/]*)$ /info/index.php?uid=$1 [L]

    Read the article

  • How to simulate Apache [END] flag on a redirect?

    - by Javier Méndez
    For business-specific reasons I created the following rewrite rule for Apache 2.2.22 (mod_rewrite): RewriteRule /site/(\d+)/([^/]+)\.html /site/$2/$1 [R=301,L] Which if given an URL like: http://www.mydomain.com/site/0999/document.html Is translated to: http://www.mydomain.com/site/document/0999.html That's the expected scenario. However, there are documents which name are only numbers. So consider the following case: http://www.mydomain.com/site/0055/0666.html Gets translated to: http://www.mydomain.com/site/0666/0055.html Which also matches my rewrite rule pattern, so I end up with "The web page resulted in too many redirects" errors from browsers. I have researched for a long time, and haven't found "good" solutions. Things I tried: Use the [END] flag. Unfortunately is not available on my Apache version nor it works with redirects. Use %{ENV:REDIRECT_STATUS} on a RewriteCond clause to end the rewrite process (L). For some reason %{ENV:REDIRECT_STATUS} is empty all the times I tried. Add a response header with the Header clause if my rule matches and then check for that header (see: here for details). Seems that a) REDIRECT_addHeader is empty b) headers are can't be set on the 301 response explicitly. There is another alternative. I could set a query parameter to the redirect URL which indicates it comes from a redirect, but I don't like that solution as it seems to hacky. Is there a way to do exactly what the [END] flag does but in older Apache versions? Such as mine 2.2.22. Thanks!

    Read the article

  • mod-rewrite: Replacing some characters in a url

    - by GeorgeCalm
    Is it possible to replace some forward slashes (/) of a URL to dots (.) in a RewriteRule? It doesn't have to be done exclusively with a RewriteRule, but definitely not with a script. Example 1: INPUT: /document/my/document.html OUTPUT: /document-my.document.html Example 2: INPUT: /document/depth/of/path/can/vary.html OUTPUT: /document-depth.of.path.can.vary.html

    Read the article

  • URL Rewrite in IIS7 Web Service - WebService.asmx => WebService in the SOAP doc

    - by Robert Kaucher
    I have an IIS7.5 (Server 2008 R2) based web service that I would like to make as independant on the current implementations technology as possible. I am using the URL rewrite module (http://learn.iis.net/page.aspx/734/url-rewrite-module/) to remove the .asmx portion of the URL and that is working fine for the HTTP request portion. However, I still see .asmx in the WSDL file when I access it. I was wondering if anyone has done this and if so, what advice could be offered. It doesn't seem like a hard problem to solve. But I have tries a number of things with "custom tags" and can't seem to get it working to save my life.

    Read the article

  • apache error log for rewrite rule

    - by Imran Naqvi
    Hi, i am getting following error in apache log File does not exist: D:/wamp/www/script/products, referer: http://localhost/script/products/category/product-123.html whenever following url localhost/script/products/category/product-123.html is parsed through this rewrite rule RewriteRule ^products/([~A-Za-z0-9-"]+)/([~A-Za-z0-9-".]+).html$ index.php?page_type=products&prod=$2 [L]. The script and rule is working fine but i am getting that error in apache error log. I have activated RewriteLog, but nothing is showing up in the rewrite.log file. Its empty. Please help and thanks in advance.

    Read the article

  • mod rewrite regex

    - by bbutle01
    The plan is to take domain.com/chat2/roomnumber and redirect to domain.com/chat2/index.php?room_id=roomnumber. Here's my code that's NOT workin: RewriteEngine on RewriteRule ^/chat2/([a-z0-9_-]+)/$ /index.php?room_id=$1 [NC,L] RewriteRule ^/chat2/([a-z0-9_-]+)$ /index.php?room_id=$1 [NC,L] I get sent to the 404 page. I'm guessing the problem is my placement of the ^ but I'm not certain.

    Read the article

  • Covert mod-rewrite to lighttpd for lessn url shortener

    - by JonKratz
    I am trying to use lessn, a url shortener by Shaun Inman, on my lighttpd server and he uses a .htaccess file for the redirect. I am not very good with Mod_Rewrite isn the first place otherwise some simple googling would have sufficed to convert this for lighttpd. As it is, I do not know what the 2nd and 3rd lines of the Mod_Rewrite are doing, so I cannot convert. I'd appreciate anyone's advice on those so I can have it working as it should. Thank you! <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule (.*) index.php?token=$1 [QSA,L] </IfModule>

    Read the article

  • Apache configuration for silent rewrite of query strings like codeigniter

    - by jwir3
    Codeigniter rewrites query strings like the following: http://somedomain.com/index.php?q=something to become: http://somedomain.com/index.php/q/something I'd like to imitate this behavior on a (very) lightweight website I am developing for a wedding RSVP system. I don't want the bloat of codeigniter, nor do I need anything else that it provides. The only thing I'd like is this. Unfortunately, I don't know how to setup a mod-rewrite rule that accomplishes this. I can setup a rule that translates /q/something into ?q=something, but I can't get one that does that without changing the URL the user is viewing. I'm basically looking for something that is, in effect, a "silent" version of the rewrite. That is, I want something that rewrites q/something to ?q=something, but leaves the user's URL in their address bar as q/something. Thanks in advance!

    Read the article

  • Rewrite request URI based on Host header in HAProxy

    - by DorinC
    I would like to set up HAProxy to forward HTTP requests to some backend servers but I need it to also rewrite the URI part based on the Host. I've read through the doc but it seems that reqirep isn't suitable for this purpose. Any idea if this is even possible with HAProxy? Here are the details of what I'm trying to accomplish: Requests that come in on: http://www.original-domain.com/ would be balanced between: http://server1/domains/www.original-domain.com/ ... http://serverN/domains/www.original-domain.com/ The proxy should be able to handle this for any number of domains (original-domain.com can be anything, it's not limited to a fixed set of values). For this to work HAProxy would need to rewrite a request like this: GET /original-uri HTTP/1.1 Host: original-domain.com to: GET /domains/original-domain.com/original-uri HTTP/1.1 Host: serverN and forward that request to one of the internal servers.

    Read the article

  • Nginx Rewrite rules for clean URLs

    - by Sujay
    I want to write nginx rewrite rules for clean URLs. Everytime the user hits http://domain.com/abc/12/16/abc-def-ghi I need to execute domain.com/abc.php?a=12&b=16&c=abc-def-ghi. Now my regex is right as per rubular: ^\/abc\/(\d+)\/(\d+)\/(\w+\S+)$ http://rubular.com/regexes/11063 and rule is if (!-e $request_filename) { rewrite ^\/abc\/(\d+)\/(\d+)\/(\w+\S+)$ abc.php?a=$1&b=$2&c=$3 last; } But it is giving "No input File specified". I cant find what the problem is?

    Read the article

  • Help with Rewrite rules.

    - by Kyle
    I was wondering what a rewrite statement that looks for this situation. I want to have multiple users on my server. Each user can have 'VirtualDocumentRoot' like sites in his directory. For example, they just make a directory like 'example.com' in their home directory, and it's hosted. The problem is I don't know if VirtualDocumentRoot can do this, or if it would take a rewrite rule that looks in all the users folders for a domain. Can anybody help me?

    Read the article

  • Nginx Rewrite rules for clean URLs

    - by Sujay
    I want to write nginx rewrite rules for clean URLs. Everytime the user hits http://domain.com/abc/12/16/abc-def-ghi I need to execute domain.com/abc.php?a=12&b=16&c=abc-def-ghi. Now my regex is right as per rubular: ^\/abc\/(\d+)\/(\d+)\/(\w+\S+)$ http://rubular.com/regexes/11063 and rule is if (!-e $request_filename) { rewrite ^\/abc\/(\d+)\/(\d+)\/(\w+\S+)$ abc.php?a=$1&b=$2&c=$3 last; } But it is giving "No input File specified". I cant find what the problem is?

    Read the article

  • CakePHP in a subdirectory using nginx (Rewrite rules?)

    - by lhnz
    I managed to get this to work a while back, but on returning to the cakephp project I had started it seems that whatever changes I've made to nginx recently (or perhaps a recent update) have broken my rewrite rules. Currently I have: worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { root html; index index.php index.html index.htm; } location /basic_cake/ { index index.php; if (-f $request_filename) { break; } if (!-f $request_filename) { rewrite ^/basic_cake/(.+)$ /basic_cake/index.php?url=$1 last; break; } } location /cake_test/ { index index.php; if (-f $request_filename) { break; } if (!-f $request_filename) { rewrite ^/cake_test/(.+)$ /cake_test/index.php?url=$1 last; break; } } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } server { listen 8081; server_name localhost; root /srv/http/html/xsp; location / { index index.html index.htm index.aspx default.aspx; } location ~ \.(aspx|asmx|ashx|asax|ascx|soap|rem|axd|cs|config|dll)$ { fastcgi_pass 127.0.0.1:9001; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } } The problem that I have is that the css and images will not load from the webroot. Instead if I visit http://localhost/basic_cake/css/cake.generic.css, I get a page which tells me: CakePHP: the rapid development php framework Missing Controller Error: CssController could not be found. Error: Create the class CssController below in file: app/controllers/css_controller.php var $name = 'Css'; } ? Notice: If you want to customize this error message, create app/views/errors/missing_controller.ctp CakePHP: the rapid development php framework Does anybody have any ideas on how to fix this?

    Read the article

  • mod rewrite help

    - by Benny B
    Ok, I don't know regex very well so I used a generator to help me make a simple mod_rewrite that works. Here's my full URL https://www.huttonchase.com/prodDetails.php?id_prd=683 For testing to make sure I CAN use this, I used this: RewriteRule prodDetails/(.*)/$ /prodDetails.php?id_prd=$1 So I can use the URL http://www.huttonchase.com/prodDetails/683/ If you click it, it works but it completely messes up the relative paths. There are a few work-arounds but I want something a little different. https://www.huttonchase.com/prod_683_stainless-steel-flask I want it to see that 'prod' is going to tell it which rule it's matching, 683 is the product number that I'm looking up in the database, and I want it to just IGNORE the last part, it's there only for SEO and to make the link mean something to customers. I'm told that this should work, but it's not: RewriteRule ^prod_([^-]*)_([^-]*)$ /prodDetails.php?id_prd=$1 [L] Once I get the first one to work I'll write one for Categories: https://www.huttonchase.com/cat_11_drinkware And database driven text pages: https://www.huttonchase.com/page_44_terms-of-service BTW, I can flip around my use of dash and underscore if need be. Also, is it better to end the URLs with a slash or without? Thanks!

    Read the article

  • mod-rewrite: what's wrong with this simple rewrite to redirect to a subdirectory?

    - by Tom Auger
    the root directory http: // www .mydomain .com (SF won't let me post hyperlinks - rep is too low) has a catchall index.php page in it, and an .htaccess file. Within this root directoy I have a wordpress/ directory which contains (suprise surprise) a wordpress installation. My goal is that when the user types in http: // www .mydomain .com they are instead taken to http: // www .mydomain .com/wordpress Here is my rewrite rule: RewriteEngine on RewriteCond %{REQUEST_URI} !^/wordpress RewriteRule ^/(.*)$ http://%{SERVER_NAME}/wordpress/$1 [L] At the moment it appears to do nothing - it still loads index.php within the root directory. What should my rewrite rule be (I'm assuming the one I'm using is wrong)?

    Read the article

  • Lighttpd with FastCGI configuration running ViewVC - rewrite problems

    - by 0xC0000022L
    At the moment I am struggling with the configuration of lighttpd together with ViewVC. The configuration was ported from Apache 2.2.x, which is still running on the machine, serving the WebDAV/SVN stuff, being proxied through. Now, the problem I am having appears to be with the rewrite rules and I'm not really sure what I am missing here. Here's my configuration (slightly condensed to keep it concise): var.hgwebfcgi = "/var/www/vcs/bin/hgweb.fcgi" var.viewvcfcgi = "/var/www/vcs/bin/wsgi/viewvc.fcgi" var.viewvcstatic = "/var/www/vcs/templates/docroot" var.vcs_errorlog = "/var/log/lighttpd/error.log" var.vcs_accesslog = "/var/log/lighttpd/access.log" $HTTP["host"] =~ "domain.tld" { $SERVER["socket"] == ":443" { protocol = "https://" ssl.engine = "enable" ssl.pemfile = "/etc/lighttpd/ssl/..." ssl.ca-file = "/etc/lighttpd/ssl/..." ssl.use-sslv2 = "disable" setenv.add-environment = ( "HTTPS" => "on" ) url.rewrite-once += ("^/mercurial$" => "/mercurial/" ) url.rewrite-once += ("^/$" => "/viewvc.fcgi" ) alias.url += ( "/viewvc-static" => var.viewvcstatic ) alias.url += ( "/robots.txt" => var.robots ) alias.url += ( "/favicon.ico" => var.favicon ) alias.url += ( "/mercurial" => var.hgwebfcgi ) alias.url += ( "/viewvc.fcgi" => var.viewvcfcgi ) $HTTP["url"] =~ "^/mercurial" { fastcgi.server += ( ".fcgi" => ( ( "bin-path" => var.hgwebfcgi, "socket" => "/tmp/hgwebdir.sock", "min-procs" => 1, "max-procs" => 5 ) ) ) } else $HTTP["url"] =~ "^/viewvc\.fcgi" { fastcgi.server += ( ".fcgi" => ( ( "bin-path" => var.viewvcfcgi, "socket" => "/tmp/viewvc.sock", "min-procs" => 1, "max-procs" => 5 ) ) ) } expire.url = ( "/viewvc-static" => "access plus 60 days" ) server.errorlog = var.vcs_errorlog accesslog.filename = var.vcs_accesslog } } Now, when I access the domain.tld, I correctly see the index of the repositories. However, when I look at the links for each respective repository (or click them, for that matter), it's of the form https://domain.tld/viewvc.fcgi/reponame instead of the intended https://domain.tld/reponame. What do I have to change/add to achieve this? Do I have to "abuse" the index file mechanism somehow? Goal is to keep the /mercurial alias functional. So far I've tried sifting through the lighttpd book from Packt again, also through the lighttpd documentation, but found nothing that seemed to match the problem.

    Read the article

  • Apache url rewrite to Nginx

    - by Kaloyan
    i work on a little php platform and my server is nginx. The first version of this php site was developed for Apache server. I need to upgrade the site and to migrate it to nginx server. The problem is url rewriting. I have this simple url rewrite rules in my Apache server: RewriteEngine On RewriteBase /simple-php/ RewriteCond %{REQUEST_FILENAME} !-d [NC] RewriteCond %{REQUEST_FILENAME} !-f [NC] RewriteRule ^(.*)$ viewpost.php?id=$1 [QSA,L] I can't "translate" this to nginx rewrite syntax. Can anybody help me? P.S. I can read both documentations, but i have not this time, just need fast solution. Thanks!

    Read the article

  • IIS7 Rewrite rule being duplicated across 2 different websites (unwanted)

    - by Matt
    We have a IIS7 on Windows Server 2008. It is hosting a handful of sites, on a handful of ip addresses. 2 of those sites are actually wildcards on the domain: *.firstdomain.com *.seconddomain.com However, I am finding that any URL Rewrite rules I add for one of these "websites", is automatically in the URL Rewrite section for the other. Similarly, if I disable the rule in in one, it disables in the other. This doesn't happen with the other sites defined on this server, just these two. I look at the parent (top level, the server as a whole), and the rule is not there. Any idea what's going on here?

    Read the article

  • Apache rewrite rules behind a nginx proxy

    - by Tuinslak
    Hi, I am running nginx (:80) in front of an Apache webserver (:8080) Nginx config (snippet): location / { proxy_pass http://www.domain.tld:8080; proxy_set_header X-Real-IP $remote_addr; If I set localhost instead of www.domain.tld, my browser gets redirect to http://localhost:8080. Apache rewrite rules: RewriteEngine On Options +FollowSymlinks RewriteBase / RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !\..+$ RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) http://%{HTTP_HOST}/$1/ [L,R=301] RewriteCond %{REQUEST_URI} !v2/ RewriteRule ^(.*)$ v1/$1 [L] So far, so good. However, every link (which uses relative paths) appears as http://www.domain.tld:8080/page instead of staying on port 80. Is there any way to solve this through the rewrite rules? I don't want to use absolute paths. Thanks

    Read the article

  • nginx rewrite for wikkawiki

    - by Hans
    Just setup WikkaWiki on my server, I have been trying to have the links go from wiki.mysite.info/wikka.php?wakka=Start into wiki.mysite.info/DotMG. I tried following their guide at http://docs.wikkawiki.org/ModRewrite, however it seems incomplete and outdated. Furthermore, as of version 1.3.2 base_url isn't even manually configurable from the wikka.config.php file. I am using version 1.3.2 of WikkaWiki. My nginx virtual hosts file contains: server { listen 80; server_name wiki.mysite.info; root /usr/share/nginx/wikka/; access_log /usr/share/nginx/.access/wikka; error_log /usr/share/nginx/.error/wikka error; location / { index index.php; try_files $uri $uri/ @wikka; } location @wikka { rewrite ^(.*/[^\./]*[^/])$ $1/ last; rewrite ^(.*)$ /wikka.php?wakka=$1 last; } location ~* \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include /etc/nginx/fastcgi_params; } } Thus far it works, I can go to wiki.mysite.info/APage and it'll display that page, however it doesn't work on all pages, sometime the browser simply downloads the page (For some reason it always downloads the Start page). Also when I go to wiki.mysite.info/ it downloads the wikka.php file... Furthermore, the links on the wiki have the wikka.php?wakka= so whenever I navigate around the wiki, it goes back to being wiki.mysite.info/wikka.php?wakka=APage. I think something is wrong with my rewrite but I can't say for sure. Contents of the fastcgi_params: fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; fastcgi_param HTTPS $server_https; # PHP only, required if PHP was built with --enable-force-cgi-redirect fastcgi_param REDIRECT_STATUS 200;

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >