CodeIgniter PHP Framework RewriteRules

244 views
Skip to first unread message

Victor Angelier

unread,
Mar 19, 2015, 7:51:32 AM3/19/15
to google-a...@googlegroups.com
Hi there,

I want to launch a website that uses CodeIgniter as PHP application framework. The problem is Google Friendly URL's don't work because I can't get the app.yaml setup correctly. I need to have the below rewrite rules translated to Google App Engine rules and I can't get it to work!. Please help me out!

.htaccess (RewriteRules that work on our private web-server)

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

I tried everything, different config.php settings and even de mod_rewrite.php trick. All don't work!

Cheers,

Victor Angelier

#PHP #CodeIgniter #Framework #RewriteRules #AppEngine #Yaml

Paul Canning

unread,
Mar 19, 2015, 11:44:36 AM3/19/15
to google-a...@googlegroups.com
I have a CodeIgniter application running on GAE.

There are plenty of answers on Google if you look, but to replace the .htaccess (as GAE doesn't use htaccess), use the following in your app.yaml:

handlers:
- url: /.*
  script: index.php

Victor Angelier

unread,
Apr 15, 2015, 2:19:53 AM4/15/15
to google-a...@googlegroups.com
Yeah but no config for GAE. I already found out how and why. Thanks!

application: your-project-name
version
: 1
runtime
: php
api_version
: 1
threadsafe
: true


handlers
:
- url: /favicon.ico
  static_files: public_html/
favicon.ico
  upload
: /favicon.ico
  expiration: 30d


- url: /
css/(.*\.css)
  mime_type
: text/css
  static_files
: public_html/css/\1
  upload
: public_html/css/(.*\.css)
 
# Fonts
- url: /fonts/(.*)
  static_files
: public_html/fonts/\1
  upload
: public_html/fonts/
 
# Javascript
- url: /js/(.*\.js)
  mime_type
: text/javascript
  static_files
: public_html/js/\1
  upload
: public_html/js/(.*\.js)


# Image files
- url: /img/(.*\.(bmp|gif|ico|jpeg|jpg|png))
  static_files
: public_html/img/\1
  upload
: public_html/img/(.*\.(bmp|gif|ico|jpeg|jpg|png))


# Catch all unhandled requests
- url: /
  script: public_html/
index.php
   
# mod_rewrite by forwarding the requests to index.php?q=...
- url: /(.*)
  script: public_html/
index.php

Reply all
Reply to author
Forward
0 new messages