Symfony : How to disable the routing system on other folders - php

I'm using Symfony for my new website but I have a problem : I can't seem to be able to access the forum anymore.
These are my folders on my server:
I found a solution but it doesn't work well - in my .htaccess (location: /website/web/) I put this:
RewriteRule ^(ddl|phpmyadmin|forum)($|/) - [L]
With SymLinks for forum, ddl and phpmyadmin in /website/web/
With this solution, I can see the forum but I can't access to the upload system because of the URL : http://www.website.fr/forum/upload/
Is there a solution to access http://www.website.fr/fichiers/ or http://www.website.fr/forum/ without the routing system of Symfony?

Ok... I just had to add index.php at the end of the URL and it works now. But this system with SymLinks is weird.

Related

Laravel remove public route AND disable it for accessing

I am using Laravel 7 within my last project.
I used the same approach on all my Laravel projects to remove the 'public' from the route:
- create a .htaccess within the root folder and add:
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
I agree, that this method is all around the google and also works locally. Everything perfect until here.
The problem is that I made a facebook ad campaign on this project which points to the homepage (/) of the website and also added a 'Book Now' button with a link to it. The strange thing is that the link from Facebook ad, points to mywebsite.com/public even I specified only mywebsite.com so I just tried to manual access that route with public, and it worked.
So looks like my website's homepage is / and /public/ in the same time.
I want to be accessible only on / and disable the 'public'. Maybe if it's still specified, to be redirected to /.
I also read about that kind of fix to rename 'server.php' to 'index.php' and copy the .htaccess from public to the root, but there are a lot of negative advices not to do this for security reasons.
What would be the proper and also secure way to achive this ?

remove /web from url symfony 3.3 by htaccess

i am working on symfony 3.3 application, i deploy it on server it's working fine; now my problem is how to remove /web from my URL:
From this:
http://www.example.com/web
To this:
http://www.example.com/
For information, i had already found too many solution like changing in my apache conf, or from .htaccess
For me i want modify my htaccess not the apache conf
Can anyone give me the solution to my problem, i will appreciate that
I think you do not have to change htaccess. I think you put everithing in public_html folder on server. No. Your web folder content should be in public_html on server. Other folders should be in the same as public_html. That way your url do not need /web. Do not worry for name of web folder change. Symfony is ok with it.

php - 404 Page Not Found codeigniter url

my framework is codeigniter and my site works fine.
example :
www.example.com/
now,I have copied all my codeigniter's folders to another dir like this:
www.example.com/test
now my urls:
www.example.com/profile //works fine
www.example.com/test/profile //not work
I get 404 page not found .
I changed base_url to :
$config['base_url'] = 'http://www.example.com/test';
where is my wrong?
please have a look at your .htaccess file. Because it'll be in the RewriteBase condition in there. Check it and tell what You found.
Codeigniter does not support multiple subdirectory levels in your controllers
But still you can extend it.
You might have to extend Router Class
Do you still have all CodeIgniter files in your main directory?
If yes, then you must remove them or you can create SUBDOMAIN to solve the issue.
Note: Codeigniter don't support multiple subdirectory levels in your controllers.
If no, then you must look for your .htaccess file, it'll be the RewriteBase condition in there.

Install Cometchat Laravel 5

So I'm new with laravel and I wanted to install cometchat into my app (I bought their basic package for $50).
I noticed that they had a bunch of supported MVCs except for Laravel, so I though it wouldn't be that hard to install it myself. It's been 3 days and I'm not giving up yet!
I'm assuming I have to extract the whole cometchat file into the /public folder in laravel but I can't get access /public/install.php
Has anyone ever tried to do this? If so, any help?
Thank you all! :)
This is how you get it to work.
Download cometchat as a "custom coded site" (This will be under Download page) and extract it to /public/cometchat (If you don't have a cometchat folder in your public folder, make one).
Configure your integration.php with the right DB credentials and now you can access your install.php via http://localhost/public/cometchat/install.php
If you don't want the public folder to be shown in the url, create a .htaccess file and place it in the root directory of your progect
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
If you do have the .htaccess setup like above, access http://localhost/cometchat/install.php
One the installation is completed, remove the install.php file and you're done :)
Make sure you access localhost/cometchat/admin/ to change your admin credentials!

Deployed Yii app don't build url properly to domain subfolder

EDIT (a solution):
In the end, the problem wasn't with yii configuration or with the virtual server, but with the main server. I contacted the server administrator and the issue was solved by changing the URL to which the main server (where mi virtual server is hosted into) redirects the requests, to append the string containing the virtual folder's name.
I'm not sure if this was the best solution, but it's a solution. So if you face a similar problem, you might want to contact your server administrator.
Here's the detail of the original problem and some of the options I tried, just for reference:
I've been developing a Yii application for a couple of weeks, and it works perfectly on my local server, but I'm having some troubles to make the URLs work properly when deploying the app.
In the server, I have an structure similar to this:
/www/MyApp/(index.php, protected folder, etc)
/www/yii (the framework is located here)
And I can access my website using an URL like this:
www.somedomain.ac/VirtualFolder/MyApp
My problem is that all the links generated by yii are pointed to (for example):
www.somedomain.ac/MyApp/index.php?r=controller/index
instead of
www.somedomain.ac/VirtualFolder/MyApp/index.php?r=controller/index
I tried modifying the urlManager section at the configuration, and for some reason adding these rules:
'../../VirtualFolder/MyApp/index.php/'.'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'../../VirtualFolder/MyApp/index.php/'.'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
make some of the builded URLs point to the proper action, with the complete URL, but still, other ones won't work (all the ones that send a form to the server).
I've been trying other solutions to similar problems during a couple of days (like changing the app's basepath, adding "VirtualFolder" to it) but they don't seem to work.
Suggestions on how to solve the problem will be very appreciated.
Thanks.
============================================
EDIT: I am trying to do it with an .htaccess file like this:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} somedomain.ac$ [NC]
RewriteCond %{HTTP_HOST} !VirtualFolder
RewriteRule ^(.*)$ http://somedomain.ac/VirtualFolder/$1 [R=301,L]
And I copied it to my web root, but not working yet. Also tried copying it to MyApp/protected folder and directly into MyApp. Am I missing something?
Thanks.
You should try to add RewriteBase directive to .htaccess file
(how the problem was solved): In the end, the problem wasn't with yii configuration or with the virtual server, but with the main server. I contacted the server administrator and the issue was solved by changing the URL to which the main server (where my virtual server is hosted into) redirects the requests, to include the string containing the virtual folder's name.
So if you face a similar problem, you might want to contact your server administrator.

Categories