Mango Blog Repeated URL Error (404 Error)

I am working on creating an instance of Mango Blog on an Ubuntu server using Apache 2 HTTPD and Tomcat 6 with Railo 3.1.2. I was able to tweak all the settings until I tried to implement URL rewriting for blog URLs.

I used a combination of Adam Tuttle and John Sieber to get rewriting rules. I have a site setup as follows:

{Webroot} /. Htaccess

RewriteEngine on RewriteBase / # archives rule must be located before page rule for paging to work correctly RewriteRule archives/(.*)$ archives.cfm/$1 [PT,L,NC] RewriteRule page/(.*)$ page.cfm/$1 [PT,L,NC] RewriteRule post/(.*)$ post.cfm/$1 [PT,L,NC] RewriteRule author/(.*)$ author.cfm/$1 [PT,L,NC] 

{apache home} / support sites / site_name

 <VirtualHost *:80> ServerAdmin ******* DocumentRoot /var/www/******/www ServerName mango.*****.com DirectoryIndex index.cfm <Directory /var/www/*******.com/www/> Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/error-*******_com.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access-********_com.log combined ProxyPreserveHost Off ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://********.com:8009/ </VirtualHost> 

When I visit blog entries by going to / post / hello -world on the site, I get 404 error. If I go to /post.cfm/hello-world, the message will appear just fine. I tried rewrite rules with rewrite tester , and said rewrite should work fine. I am very new to transcribing, so I apologize if this is something simple.

+7
source share
3 answers

Insert the .htaccess file:

 Options -Multiviews 
+2
source

Try moving the rewrite rules to the VirtualHost block. I had weird issues with .htaccess w / rewrites not working correctly.

Maybe I'm wrong, but that’s what I think.

Apache will look for / post /, which does not exist, and returns 404. It would run .htaccess if it existed in / post /, but that is not the case.

If the rewrite rules are in the Directory block inside the VirtualHost block in the httpd.conf file, then Apache knows what to redirect and not look for / post /.

 <VirtualHost *:80> ServerAdmin ******* DocumentRoot /var/www/******/www ServerName mango.*****.com DirectoryIndex index.cfm <Directory /var/www/*******.com/www/> Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny allow from all RewriteEngine on RewriteBase / # archives rule must be located before page rule for paging to work correctly RewriteRule archives/(.*)$ archives.cfm/$1 [PT,L,NC] RewriteRule page/(.*)$ page.cfm/$1 [PT,L,NC] RewriteRule post/(.*)$ post.cfm/$1 [PT,L,NC] RewriteRule author/(.*)$ author.cfm/$1 [PT,L,NC] </Directory> ErrorLog /var/log/apache2/error-*******_com.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access-********_com.log combined ProxyPreserveHost Off ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://********.com:8009/ 

0
source

Your problem may be related to your RewriteBase. When I uploaded your example to a test server, I saw in the Apache error logs that using RewriteBase worked for me because of the environment I used; however, using / in your case may not create the correct path.

In the web server error logs, see which path is generated when it says that it cannot find the 404 error. It will probably say something like:

 [21/May/2011:17:29:20 +0000] [error] [client #.#.#.#] File does not exist: /path/to/something/not/quite/right/post.cfm/hello_world 

Follow the path to make sure that it actually leads you to the actual location of the server where the * .cfm files are located. Then just modify the RewriteBase to make it correct.

Hope this helps.

0
source

All Articles