Wednesday, December 17, 2014

Not allowed use mod_rewrite... Trying to get pretty urls to work... No css or js

I have a working "site" on my development machine that uses mod_rewrite.  However, I'm informed that I will not be able to deploy the site with mod_rewrite... so the docs say:

App.baseUrl

If you don't want or can't get mod_rewrite (or some other compatible module) up and running on your server, you'll need to use CakePHP's built-in pretty URLs. In /app/Config/core.php, uncomment the line that looks like:

Configure::write('App.baseUrl', env('SCRIPT_NAME'));  

Also remove these .htaccess files:

/.htaccess  /app/.htaccess  /app/webroot/.htaccess  

This will make your URLs look like www.example.com/index.php/controllername/actionname/param rather than www.example.com/controllername/actionname/param.

If you are installing CakePHP on a webserver besides Apache, you can find instructions for getting URL rewriting working for other servers under the URL Rewriting section.


Those are the ONLY changes specified in the docs!
Now the following code in my default.ctp:

echo $this->Html->css('cake.generic.css');

$scriptOptions = array('once' => true);
echo $this->Html->script('jquery/1.9/jquery-1.9.1.js', $scriptOptions);

Produces errors:

"NetworkError: 404 Not Found - http://mydomain:8080/app/webroot/css/cake.generic.css"
"NetworkError: 404 Not Found - http://mydomain:8080/app/webroot/js/jquery/1.9/jquery-1.9.1.js"

The actual location of the file:

E:\mydomain\app\webroot\css

So there has to be something more to do...  I did NOT remove the loading of mod_rewrite on this machine, but there are NO .htaccess files within the domain!

Thanks for any assistance,

Greg

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: