How to make a Symfony2 Bundle Live on a Website - symfony

Sorry if this is a dumb question, but I have been looking around for a bit with no luck finding an answer. I am new to Symfony2 and spent the last couple weeks installing it on my website's server, making a bundle and building all the pages, and testing it out with its app_dev.php urls. I'm now ready to make it public on my site, but I'm not sure how to go about doing this. Basically, I want to activate the bundles so instead of having to go to website/symfony/web/app_dev.php/Page, I can just go to website/Page. Thanks!

Ok, so thats not really a Symfony issues and it depends very much on your environment (mostly what webserver you are using). What you have to do is make the web folder of the symfony project your root folder (aka, where right now is the symfony folder) and move all other folder within symfony folder one level up. So lets say you have your httpdocs or www folder as your root folder, you have to copy the contents of symfony/web in that folder and move everything else from symfony folder one level above httpdocs folder. That being said, probably there is a lot more configuration that goes on into it. Here are a couple of resources to get you started:
http://symfony.com/doc/current/cookbook/deployment-tools.html
Symfony2: How to deploy in subdirectory (Apache)
Remember that in live mode you should be accessing app.php and not app_dev.php...

I tend to do it by adding those lines to an .htaccess file on the root:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ web/$1 [QSA,L]
</IfModule>
Then the original .htaccess file in the web directory takes care of the rest.

Related

Elgg with within subdirectory that is not executed by elgg

I have website that run elgg in root directory.
But I want into subdirectory that is located within elgg put wordpress site.
Example:
www.mysite.com - elgg,
www.mysite.com/wp - wordpress
Yes, and I don't need any kind of integration between them (no bridge)
Just to elgg not to execute this folder
So I need for directory www.mysite.com/wp different rules than for rest site.
I tried changing .htaccess file for www.mysite.com/wp directory, but I think it's wrong way.
It is working only for simple .php files, but wordpress is more complex and after long period of loading It show elgg "nothing found" site loaded.
Please don't ask change site structure, it is already set. And wordpress in subdirectory also has it's reasons.
I know there must be easy solution for this issue like elgg plugin for subdirectories, but problem is that web is flooded with topics about installing elgg in subdirectory and I can't find solution.
You can use a rewrite rule that uses ^$ to represent the root and rewrite that to your /wp directory, and write this just above index.php like this:
RewriteEngine On
RewriteRule ^wp(.*)$ /wp [L]
RewriteRule ^(.*)$ index.php?__elgg_uri=$1 [QSA,L]

Wordpress Install with other software installed in a subdirectory

I'm having an issue that I think can be solved with .htaccess, however, I'm not sure exactly how, htaccess rules have never been a strong point for me.
I have a domain with WHMCS installed on it, in a subdirectory, like this:
/websites/manage/
the /websites/ directory is otherwise empty.
Now, I have installed WordPress on the root of the domain, and I want to use the /websites/ location in the WordPress permalink structure, as I want to build a WordPress page that describes the products and services available there, and use it as a gateway to the WHMCS portal located beneath it.
I've tried searching for an answer to this problem, but I keep turning up tons of results about installing wordpress in a subdirectory, and nothing else.
Thanks for your help.
EDIT:
I should have mentioned:
Currently, I get the WHMCS portal when I go to /websites/manage/, which is fine.
However, my problem is that when I go /websites/ I get a directory listing instead of my WordPress page.
I solved this by adding the following to the beginning .htaccess file, before the WordPress section:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/websites/$
RewriteRule . /index.php
</IfModule>
This redirects the /websites/ directory to the /index.php file which WordPress can then use to find its matching page. It still allows the sub directory /websites/manage/ to be controlled by the WHMCS software residing there.

Static PHP application directory on a wordpress site

I'm having trouble setting up a directory with php files on a wordpress site.
I understand how to use templates to include a custom php file, but what I'm trying to do is access a php file as if wordpress was not installed. Right now when I create a new directory(dir1) and put an index.php file in that folder, then try to view by going to www.test.com/dir1 it shows a bulleted list with links to header, background, and updates with a text input for searching the website at the bottom.
I'm not sure if this is something that needs to be configure in my cPanel or if its a wordpress setting, or even if its an htaccess issue.
Please help me figure out what I need to do, or even at the very least, help me put into words what I'm trying to do. Thanks!
Usually Wordpress installed in the root has no impact at all on whatever is put into non-wp directories. Can you paste your .htaccess file from the root folder? And does your /dir1/ have any .htaccess?
Wordpress has nothing do to with existing folders/files. Here are some steps you may try.
Make sure your /dir1 doesn't have .htaccess or if in case you have and you need it to have it there, continue doing next steps.
Add some inclusions in rewrite engine of your .htaccess file. You may add something like this:
RewriteCond %{REQUEST_FILENAME} !-d and/or RewriteCond %{REQUEST_FILENAME} !-d
or
RewriteCond %{HTTP_HOST} !dir1
I hope this helps.
Bah, I've figured it out.
anytime I would FTP files onto my server, it would make the owner/group "root"
After I used WinSCP to change my users to match each website, it worked perfectly.
cPanel is a pain.

URL rewriting For WordPress - Integrating Non Wordpress site with wordpress

We are unable to change the url rewriting to integrate an exsiting directory site into my wordpress site.
WordPress is fixing everything to their url pattern.
How can I help my programmer? Can someone give an advise?
More details would be useful, but in all likelihood, add a do nothing and stop rule for your folder before the WP rules:
RewriteEngine On
RewriteBase /
RewriteRule ^folder - [L]
We integrate WordPress with Ruby-on-Rails on ICanLocalize.
This is done in the Apache config file. Use the Apache Alias command to indicate that a path comes from a different physical directory.
Then, the URLs that match that path will never go to WordPress. They will be served from the other physical directory, where you can place anything.
If you need to take a subdirectory out of the url-rewriting from wordpress, put an additional .htaccess file into that directory and switch the Rewrite-Engine off:
RewriteEngine Off
That directive overrides any settings of the wordpress .htaccess for that directory and it's subdirectories.
You find the longer version of my answer in a related question on wordpress answers with a slightly different .htaccess code.

Installing Wordpress along side Cakephp

I have cakephp installed in the root directory. site.com/
i want to install wordpress blog at site.com/blog
but since cakephp will redirect all urls i am not sure how to do it ?
From: http://dogmatic69.com/blog/development/7-using-other-apps-with-cakephp-htaccess-config
One thing that is asked quite a lot on #cakephp is how to use other apps alongside CakePHP, and the answer giving is normally pretty ugly. Stick the files/folders in side webroot/. Although that does work, its not very nice. So ill show you a little trick with .htaccess files.
The first (really simple way) is to use a .htaccess inside the sub folder. For example you can have a copy of Joomla! running alongside cake with no issues when you have the .htaccess for Joomla! enabled. If the app does not have one and/or you would not know what to put in the .htaccess file you have another option
Make Apache stop processing rewrites if it finds a request for your sub directory. This is done by adding a rule for the sub directory and then telling Apache it is the last rule to process. The .htaccess file you want to edit is the one found inside your APP directory. All you want to add is the following line:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (some_folder/.*) $1 [L] # adjust the regex to what you want.
# normal cake rules
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
You can do this for as many sub folders as you wish, by changing the regex accordingly. Its pretty simple to do and a much cleaner way than having all your stuff inside the webroot/ folder of your APP.
Simply put the wordpress install into a "blog" folder in your /app/webroot folder.
Cake will load from the webroot as if the files were in a normal subfolder under a non-cake appliation. You may need to edit / adjust paths in the wp configs or .htaccess files throughout to get everything perfect but it isn't that difficult.
One way to do this is to have your domain pointing to site.com/cakefolder and then have another subdomain blog.site.com pointing to site.com/blog folder
This way to your user, it would always be site.com and blog.site.com

Resources