Yii Framework Forum: Deploying app under Drupal - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Deploying app under Drupal Rate Topic: -----

#1 User is offline   James 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 05-December 09

Posted 14 March 2010 - 10:28 PM

Hi everyone,

I've developed an app that will sit on the same server as a running Drupal install and am finding that the rewrite rules for the Drupal site to enable search friendly links is grabbing all the requests.

Here's what my www root looks like:
webroot
|.htaccess
|myapp
|yii
|drupal files

in my .htaccess file, i've got the following in the mod_rewrite section:
# stuff to let through (ignore)
RewriteCond %{REQUEST_URI} myapp
RewriteRule (.*) $1 [L]

# Rewrite current-style URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

# Rewrite non www url to www url
RewriteCond %{HTTP_HOST} !^www\..*
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} ^([^.]*)\.(ca)
RewriteRule ^.*$ http://www.%1.%2%{REQUEST_URI} [R=permanent,L]

Now if I go to www.mydomain.ca/myapp, i get the default page for my Yii app. If I go to any other url in the app, I get redirected to Drupal, for example: www.mydomain.ca/myapp/site/login, will redirect me to www.mydomain.ca

Can anyone shed any light on this?

Thanks!

james
0

#2 User is offline   James 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 05-December 09

Posted 14 March 2010 - 11:00 PM

Ok, I figured it out, but I'll post the solution here just in case anyone else needs it.

Turning off clean URLs in my Yii app seemed to work, so tried to do clean URLs using .htaccess instead of Yii. But instead of trying to do everything in the one .htaccess file, and I would create a new one within my app: wwwroot/myapp/.htaccess

In this .htaccess file I have:
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on

Options +FollowSymLinks
IndexIgnore */*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

</IfModule>

Now it all works!

I'm no expert with mod_rewrite, so the credit goes here: http://www.thewayofc...-yii-framework/
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users