[coldbox 4.1.0] Noob Question: Apache 2.4 rewrites for SES

In the webroot of my app, I created an .htaccess file with the data found here:

http://wiki.coldbox.org/wiki/URLMappings.cfm

This is on a Mac (Yosemite) with Apache 2.4 and CF11 (developer). But the app won’t run because (best educated guess) is the URL rewrites aren’t happening. I restarted Apache just to be sure; no good. So when I login, I get mysite.local/main/login_do was not found on this server.

It works fine on the Windows production server using IIS and the rewrites there. I haven’t setup SES in Apache before so I’m not sure what I’m missing. In the past, I used CB3 and always disabled SES.

Help? :slight_smile:

Thanks!

Rob

In the routes.cfm you should remove index.cfm and get this:

`

if( len(getSetting(‘AppMapping’) ) lte 1){
setBaseURL(“http://#cgi.HTTP_HOST#/”);
}
else{
setBaseURL(“http://#cgi.HTTP_HOST#/#getSetting(‘AppMapping’)#/”);
}

`

Thanks… but that’s already there. Here’s the entirety of my routes.cfm:

// Allow unique URL or combination of URLs, we recommend both enabled

setUniqueURLS(false);

// Auto reload configuration, true in dev makes sense to reload the routes on every request

//setAutoReload(false);

// Sets automatic route extension detection and places the extension in the rc.format variable

// setExtensionDetection(true);

// The valid extensions this interceptor will detect

// setValidExtensions(‘xml,json,jsont,rss,html,htm’);

// If enabled, the interceptor will throw a 406 exception that an invalid format was detected or just ignore it

// setThrowOnInvalidExtension(true);

// Base URL

if( len(getSetting(‘AppMapping’) ) lte 1){

setBaseURL(“http://#cgi.HTTP_HOST#/”);

}

else{

setBaseURL(“http://#cgi.HTTP_HOST#/#getSetting(‘AppMapping’)#/”);

}

// Your Application Routes

addRoute(pattern=":handler/:action?");

/** Developers can modify the CGI.PATH_INFO value in advance of the SES

interceptor to do all sorts of manipulations in advance of route

detection. If provided, this function will be called by the SES

interceptor instead of referencing the value CGI.PATH_INFO.

This is a great place to perform custom manipulations to fix systemic

URL issues your Web site may have or simplify routes for i18n sites.

@Event The ColdBox RequestContext Object

**/

function PathInfoProvider(Event){

/* Example:

var URI = CGI.PATH_INFO;

if (URI eq “api/foo/bar”)

{

Event.setProxyRequest(true);

return “some/other/value/for/your/routes”;

}

*/

return CGI.PATH_INFO;

}

Do you have allowoverrides enabled in Apache. It’s possible the .htaccess isn’t even getting picked up. Also, do you have the rewrite module enabled.

What error do you see (if any) when you this that URL? Is it a CF error or Apache 404?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

BINGO!!! Thanks, Brad! That was it.

I hadn’t enabled mod_rewrite or set AllowOverrides properly. It’s been so long that I had totally forgotten. See, I told you it was a Noob question. :slight_smile:

Rob

That was going to be my suggestion too, however even if you do have index.cfm in the routes, it won’t stop it from running it will only add it to the URL in question.