.htaccess – force www, trailing slash and remove extension

I've been playing about with my .htaccess file and so far, it's working, but there's a few bugs.

I'm trying to force the WWW prefix (just the root, not on subdomains) while removing the .php extension and adding a trailing slash.

Code

# Force WWW prefix
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


# Remove .php extension
RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.php
RewriteRule (.*)\.php$ /$1/ [L,R=301]

RewriteRule (.*)/$ $1.php [L]


# Force trailing slash
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule .*[^/]$ $0/ [L,R=301]

It successfully force the WWW, even if I remove it, the .php extension is removed, even if I add it, and the the trailing slash is forced, even if I remove it. However, sometimes I get a 404 not found error saying that the requested URL (generally ending with the .php extension) was not found on the server, and often directories do not actually work. Edit

often directories do not actually work

meaning the server throws a 404 error saying "/directory.php was not found on this server".

Can anyone lend me a hand?

httpClient.getConnectionManager() is deprecated – what should be used instead?

I have inherited the code

import org.apache.http.client.HttpClient;
...
HttpClient httpclient = createHttpClientOrProxy();

    try {
        HttpPost postRequest = postRequest(data, url);
        body = readResponseIntoBody(body, httpclient, postRequest);
    } catch( IOException ioe ) {
        throw new RuntimeException("Cannot post/read", ioe);
    } finally {
        httpclient.getConnectionManager().shutdown();  // ** Deprecated
    }


private HttpClient createHttpClientOrProxy() {
    HttpClient httpclient = new DefaultHttpClient();

    /*
     * Set an HTTP proxy if it is specified in system properties.
     * 
     * http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html
     * http://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientExecuteProxy.java
     */
    if( isSet(System.getProperty("http.proxyHost")) ) {
        log.warn("http.proxyHost = " + System.getProperty("http.proxyHost") );
        log.warn("http.proxyPort = " + System.getProperty("http.proxyPort"));
        int port = 80;
        if( isSet(System.getProperty("http.proxyPort")) ) {
            port = Integer.parseInt(System.getProperty("http.proxyPort"));
        }
        HttpHost proxy = new HttpHost(System.getProperty("http.proxyHost"), port, "http");
// @Deprecated methods here... getParams() and ConnRoutePNames
        httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
    }
    return httpclient;
}

getConnectionManager() reads "

@Deprecated
ClientConnectionManager getConnectionManager()

Deprecated. (4.3) use HttpClientBuilder.
Obtains the connection manager used by this client.

The docs for HttpClientBuilder seem sparse and simply say:

Builder for CloseableHttpClient instances.

However if I replace HttpClient with CloseableHttpClient the method still seems @Deprecated.

How can I use a non-Deprecated method?

Unable to read Jquery,css, in Apache web server in linux Operating syetem

enter image description hereThis my Project plz see the screen.enter image description here

same code i have deployed in apace tomcat server in Linux operating system. in that i am unable to open data calender popup windows [date calender is coming using jquery code] Window Os deployed project Output: looking like this enter image description here

Linux Os deployed project Output: and also some of function is not working which is related to java scrip and Jquery css or html plz help me is there any change we ll have to do in Linux Os. in tomcat server in windows is working perfect .

please check i have Update see my command Linux unable to change file permission

Permission denied: /var/www/abc/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable?

Hi all I'm using PHP for my website and ubuntu linux on my system. I got the above error in error.log file of apache, even after configurating everything properly. I did a lot of research on this but couldn't be able to resolve the issue. Can anyone please help me in this reagard? Following is my .htaccess file in abc directory. Can anyone please help me in this regard?

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName abc.org
AuthUserFile /home/abc/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/abc/public_html/_vti_pvt/service.grp
Options -Indexes

RewriteEngine On
RewriteRule ^alumni$ alumni.php
RewriteRule ^student$ student.php
RewriteRule ^view_alumni_article/view/([0-9]+)$ view_alumni_article.php?op=view&article_id=$1

build hadoop 2.2 on windows

I am trying to install hadoop on windows, it is so troublesome so far.

here is error i keep getting

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec (compile-ms-winutils) on project hadoop-common: Command execution failed. Cannot run program "msbuild" (in directory "C:\hdfs\hadoop-common-project\hadoop-common"): CreateProcess error=2, The system cannot find the file specified -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :hadoop-common

I have msbuild.exe, windows sdk7.1, cygwin64, maven3.0.5, jdk7 all set up in environment on my windows 7 x64 box.

This is hadoop 2.2.0 src which i downloaded from apache website.

under system environment, i have set

C:\Windows\Microsoft.NET\Framework64\v4.0.30319

this is the path to msbuild, but still doesn't work, does anyone know how to fix this?

thanks

update: I changed pom.xml at hadoop-common-project\hadoop-common a little from

<executable>msbuild</executable>

to

<executable>msbuild.exe</executable>

Now, I'm getting following error

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec (compile-ms-winutils) on project hadoop-common: Command execution failed. Process exited with an error: 1(Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :hadoop-common

Site does not exist error for a2ensite

I have cmsplus.dev under /etc/apache2/sites-available with the following code,

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName www.cmsplus.dev
    ServerAlias cmsplus.dev

    DocumentRoot /var/www/cmsplus.dev/public

    LogLevel warn
    ErrorLog /var/www/cmsplus.dev/log/error.log
    CustomLog /var/www/cmsplus.dev/log/access.log combined
</VirtualHost>

Now when I use sudo /usr/sbin/a2ensite cmsplus.dev, I am getting the error,

ERROR: Site cmsplus.dev does not exist!

My webserver Apache/2.4.6 (Ubuntu)

How to solve this issue?

XAMPP – Port 80 in use by "Unable to open process" with PID 4! 12

I have been trying to figure out how to fix this problem for two days. I'm new to this kind of thing so I would appreciate it if someone could tell me how to fix it.

I've tried deleting skype but that didn't work, I've tried turning off the world wide web thing off, IIS off nothing seems to work.

12:51:22 PM  [Apache]   Problem detected!
12:51:22 PM  [Apache]   Port 80 in use by "Unable to open process" with PID 4!
12:51:22 PM  [Apache]   Apache WILL NOT start without the configured ports free!
12:51:22 PM  [Apache]   You need to uninstall/disable/reconfigure the blocking application
12:51:22 PM  [Apache]   or reconfigure Apache and the Control Panel to listen on a different port

The website is under heavy load + ROR

We are running a website with ROR on CentOS 6 with 2 web server and 1 database server. Some times it shows message "The website is under heavy load"... Can some plese help you what to check here.

We are using Passenger 4.0.21 with Ruby 1.8.7 and Apache 2.2.15. Web server is running with the default settings.

Below is some output of passenger-status:

# passenger-status

Version : 4.0.21
Date    : Thu Dec 12 02:02:44 -0500 2013
Instance: 20126
----------- General information -----------
Max pool size : 6
Processes     : 6
Requests in top-level queue : 0

----------- Application groups -----------
/home/web/html#default:
  App root: /home/web/html
  Requests in queue: 100
  * PID: 20290   Sessions: 1       Processed: 53      Uptime: 24h 3m 5s
    CPU: 0%      Memory  : 634M    Last used: 23h 16m 8
  * PID: 22657   Sessions: 1       Processed: 37      Uptime: 23h 15m 55s
    CPU: 0%      Memory  : 609M    Last used: 22h 44m
  * PID: 29147   Sessions: 1       Processed: 146     Uptime: 20h 47m 48s
    CPU: 0%      Memory  : 976M    Last used: 18h 20m
  * PID: 22216   Sessions: 1       Processed: 26      Uptime: 10h 3m 19s
    CPU: 0%      Memory  : 538M    Last used: 9h 44m 4
  * PID: 23306   Sessions: 1       Processed: 75      Uptime: 9h 43m 22s
    CPU: 0%      Memory  : 483M    Last used: 8h 44m 4
  * PID: 25626   Sessions: 1       Processed: 115     Uptime: 8h 46m 42s
    CPU: 0%      Memory  : 540M    Last used: 7h 59m 5

Joomla! URL Rewrite creates 404 error

I have a problem with my joomla and the URL Rewrite function. I have activated this function in backend and renamed the htaccess.txt to .htaccess. But now I get a 404 error on every menu link.

You can find the site here: (removed after solution found)

I used the standard htaccess file.

I already checked - mo_rewrite is active.

I also have added a image where you can see the system information. enter image description here

Can you help?