I am working on setting up an instance of Mango Blog on an Ubuntu Server running Apache 2 HTTPD and Tomcat 6 with Railo 3.1.2. I was able to get everything setup until I started trying to implement URL rewriting for the blog URLs.
I used a combination of Adam Tuttle's and John Sieber's posts to get the rewrite rules. I have the 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}/sites-enabled/sitename
<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 posts by going to /post/hello-world on the site I get a 404 error. If I go to /post.cfm/hello-world the post comes up just fine. I tried the rewrite rules against a rewrite tester, and that said that the rewrites should work fine. I am very new to rewriting, so I apologize if this is something simple.
URL rewriting and security are two different things. The URL rewrite simply changes the presentation of variables in the url but does not secure at all. We must secure the variables in your code after you recover from the url.
Create Rewrite Rule This rule matches any requested URL; if the URL does not correspond to a file or a folder on a file system, then the rule rewrites the URL to Index. php and determines which content to serve based on the REQUEST_URI server variable that contains the original URL before it was modified by the rule.
URL rewriting purpose is to change the appearance of the URL to a more user-friendly URL. This modification is called URL rewriting. For example, http://example.com/form.html can be rewritten as http://example.com/form using URL rewriting.
Put in your .htaccess file:
Options -Multiviews
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With