How to rewrite the index.php of Codeigniter on Windows Azure

You can add rewrite rules in your web.config file. Add the following to the system.webServer section: <rewrite> <rules> <rule name=”Rule” stopProcessing=”true”> <match url=”^(.*)$” ignoreCase=”false” /> <conditions> <add input=”{REQUEST_FILENAME}” matchType=”IsFile” ignoreCase=”false” negate=”true” /> <add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” ignoreCase=”false” negate=”true” /> <add input=”{URL}” pattern=”^/favicon.ico$” ignoreCase=”false” negate=”true” /> </conditions> <action type=”Rewrite” url=”index.php/{R:1}” appendQueryString=”true” /> </rule> </rules> </rewrite>

Add slash to the end of every url (need rewrite rule for nginx)

More likely I think you would want something like this: rewrite ^([^.]*[^/])$ $1/ permanent; The Regular Expression translates to: “rewrite all URIs without any ‘.’ in them that don’t end with a “https://stackoverflow.com/” to the URI + “https://stackoverflow.com/”” Or simply: “If the URI doesn’t have a period and does not end with a slash, add … Read more

Apache rewrite – get original URL in PHP

It really depends on the PHP setup. With mod_php you oftentimes still have the original request path in REQUEST_URI. For CGI or FastCGI setups it is quite commonly REDIRECT_URL. You will have to check a phpinfo() page to be sure. If you really can’t find anything that would help, then it’s time for cheating! You … Read more

rewrite a folder name using .htaccess

mod_rewrite can only rewrite/redirect requested URIs. So you would need to request /apple/… to get it rewritten to a corresponding /folder1/…. Try this: RewriteEngine on RewriteRule ^apple/(.*) folder1/$1 This rule will rewrite every request that starts with the URI path /apple/… internally to /folder1/…. Edit    As you are actually looking for the other way round: RewriteCond … Read more

Is this the best way to rewrite the content of a file in Java?

To overwrite file foo.log with FileOutputStream: File myFoo = new File(“foo.log”); FileOutputStream fooStream = new FileOutputStream(myFoo, false); // true to append // false to overwrite. byte[] myBytes = “New Contents\n”.getBytes(); fooStream.write(myBytes); fooStream.close(); or with FileWriter : File myFoo = new File(“foo.log”); FileWriter fooWriter = new FileWriter(myFoo, false); // true to append // false to overwrite. … Read more