PDA

View Full Version : Wordpress + Quercus + Pretty permalinks (SEO Friendly URLs)


sinoea
10-10-2011, 05:49 PM
Hi there,
I have installed wordpress as subfolder in my Java web app.
The subfolder is named "articles".

Almost everything works well, however I have only one problem.
I cannot get pretty permalinks working.
I keep getting a 404 error for all SEO friendly blog post URLs and
even the URL friendly pages and category pages.

For example www.mywebsite.co.uk/articles/test-article gives me a 404 error.
If I switch back to Default URL settings then it works (www.mywebsite.co.uk/articles/?p=1).

Please help, I need to get the SEO friendly URLs working!


Here is what I am using:
--------------------------------------------------------------------------
1. Apache2.2
2. Tomcat 5.5
3. MySQL 5.1.55
4. jdk1.6.0_24
5. Windows Server 2003
6. WordPress Version 3.2.1
7. Quercus 4.0.18




Virtual host added in the httpd.conf file
-------------------------------------------------------------------------

<VirtualHost *:80>
ServerName www.mywebsite.co.uk
ServerAdmin info@mywebsite.co.uk
LogLevel error
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.mywebsite\.co.uk
RewriteRule ^(.*)$ http://www.mywebsite.co.uk$1 [R=permanent,L]
JkMount /* ajp13
JkMount /*.jsp ajp13
JkMount /*.css ajp13
JkMount /*.jpg ajp13
JkMount /*.gif ajp13
JkMount /*.js ajp13
</VirtualHost>



.htaccess file created under the "articles" folder (the wordpress application)
-------------------------------------------------------------------------

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /articles/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /articles/index.php [L]
</IfModule>
# END WordPress


Quercus Servlet and Tuckey's UrlRewriteFilter declared in the web.xml
------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="mywebsite" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<display-name>mywebsite</display-name>

<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>logLevel</param-name>
<param-value>WARN</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<servlet>
<servlet-name>Quercus Servlet</servlet-name>
<servlet-class>com.caucho.quercus.servlet.QuercusServlet</servlet-class>

<!--
Specifies the encoding Quercus should use to read in PHP scripts.
-->
<!--
<init-param>
<param-name>script-encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
-->

<!--
Tells Quercus to use the following JDBC database and to ignore the
arguments of mysql_connect().
-->
<!--
<init-param>
<param-name>database</param-name>
<param-value>jdbc/test</param-value>
</init-param>
-->

<!--
<init-param>
<param-name>ini-file</param-name>
<param-value>WEB-INF/php.ini</param-value>
</init-param>
-->

<!--
Location of the license to enable php to java compilation.
-->
<init-param>
<param-name>license-directory</param-name>
<param-value>WEB-INF/licenses</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>Quercus Servlet</servlet-name>
<url-pattern>*.php</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.php</welcome-file>
</welcome-file-list>
</web-app>


-------------------------------------------------------------------------



Regards,
Sam

iX3
12-17-2013, 07:04 PM
Hi Sam,

I am in a similar situation: Wordpress seems to work fine in my Quercus instance but only until I change the permalink structure to a non-default (i.e. pretty) structure. Then I get 404 errors when I try to go to a page like /sample-post/

If you have found a solution I would love to hear about it. Thanks.