Transplanting .htaccess URL Rewrite Rules into httpd-vhosts.conf

111 views
Skip to first unread message

Adam Chapman

unread,
May 3, 2013, 8:50:56 AM5/3/13
to cfwh...@googlegroups.com
Hi All,

Just wondering if anyone has successfully transplanted the URLRewrite rules from the .htaccess file into the Apache httpd-vhosts.conf file?

When I directly cut & paste them it causes a 400 error with nothing showing up in any log files... The same as these chaps:


They suggest that the rules need to be formatted differently in the vhosts.conf file to the htaccess file. Apparently one of the leading slashes needs to be removed.. but I must confess my regex skillz need some work.

.htaccess
# Options +FollowSymLinks
# RewriteEngine On
# RewriteCond %{REQUEST_URI} !^.*/(flex2gateway|jrunscripts|cfide|cfformgateway|cffileservlet|railo-context|files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm)($|/.*$) [NC]
# RewriteRule ^(.*)$ ./rewrite.cfm/$1 [NS,L]

Has anyone got this working, or have an answer to my pickle.

Regards,
Adam

AJ Mercer

unread,
May 3, 2013, 6:56:36 PM5/3/13
to cfwh...@googlegroups.com
the hashes (#) are comments
you will need to remove them for this stuff to work


--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cfwheels+u...@googlegroups.com.
To post to this group, send email to cfwh...@googlegroups.com.
Visit this group at http://groups.google.com/group/cfwheels?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--

AJ Mercer
<webonix:net strength="Industrial" /> | <webonix:org community="Open" />
http://twitter.com/webonix

Adam Chapman

unread,
May 3, 2013, 7:12:51 PM5/3/13
to cfwh...@googlegroups.com
Thanks AJ,

The rules in this post were just copied from github to illustratte which rules I was referring to.. though I have made that mistake before ;)

Regards,
Adam


--
You received this message because you are subscribed to a topic in the Google Groups "ColdFusion on Wheels" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cfwheels/5jj3GvJhU7I/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to cfwheels+u...@googlegroups.com.

To post to this group, send email to cfwh...@googlegroups.com.
Visit this group at http://groups.google.com/group/cfwheels?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Regards,
Adam

matthew attanasio

unread,
Feb 2, 2015, 1:10:59 AM2/2/15
to cfwh...@googlegroups.com
I second this and would like to know if any body has come up with a working method to get the Vhosts file working correctly?

jjallen

unread,
Feb 2, 2015, 11:08:46 AM2/2/15
to cfwh...@googlegroups.com
Below is an example that works for me with wheels 1.1.8 and apache 2.4 on linux.  I am replacing servername and docroot with placeholders.

You'll need FollowSymLinks enabled if you plan to keep the Rewrite rules inside the directory block.  Also you may need to set RewriteEngine On depending on what context you are placing the rules in (I do that in the example below as well).

This example does not contain everything I would typically include for a given vhost; this is just to illustrate the minimum required to enable wheels rewrites.

<VirtualHost *:80>
  ServerName myapp.test.com
  DocumentRoot /apache/public/myapp
  <Directory /apache/public/myapp>
    Options FollowSymLinks
    Require All Granted
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^.*/(flex2gateway|jrunscripts|cfide|cfformgateway|cffileservlet|railo-context|files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm)($|/.*$) [NC]
    RewriteRule ^(.*)$ ./rewrite.cfm/$1 [NS,L]
  </Directory>
<VirtualHost>

...hope this helps.
Reply all
Reply to author
Forward
0 new messages