Symfony - Path /admin accessible in local but 404 in prod environnement











up vote
0
down vote

favorite












I have added a sonata admin to my website.



In local, i can access to the path /admin but not when I push it on my prod environnement. I get a 404 when i try to access it :



Not Found
The requested URL /admin was not found on this server.



I have removed my cache in var/cache/prod



In case heres the content of my sonata_admin.yaml which is used :



_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin

admin_area:
resource: "@SonataAdminBundle/Resources/config/routing/sonata_admin.xml"
prefix: /admin

sonata_user_admin_security:
resource: '@SonataUserBundle/Resources/config/routing/admin_security.xml'
prefix: /admin

sonata_user_admin_resetting:
resource: '@SonataUserBundle/Resources/config/routing/admin_resetting.xml'
prefix: /admin/resetting


Do I have to configure something, to access these paths on my server ? Or does this has anything to do with the .htaccess file.



Any clue of what might be causing this problem ?



Thank you in advance for your help !



UPDATE : Heres what I have when I do debug:router command on my localhost (can't do it in production)



D:website>php bin/console debug:router
------------------------------------------ ---------- -------- ------ ----------------------------------------------------
Name Method Scheme Host Path
------------------------------------------ ---------- -------- ------ ----------------------------------------------------
homepage ANY ANY ANY /
_twig_error_test ANY ANY ANY /_error/{code}.{_format}
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler_open_file ANY ANY ANY /_profiler/open
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
webhook_index ANY ANY ANY /mailchimp/webhook/endpoint
admin_app_event_list ANY ANY ANY /admin/app/event/list
admin_app_event_create ANY ANY ANY /admin/app/event/create
admin_app_event_batch ANY ANY ANY /admin/app/event/batch
admin_app_event_edit ANY ANY ANY /admin/app/event/{id}/edit
admin_app_event_delete ANY ANY ANY /admin/app/event/{id}/delete
admin_app_event_show ANY ANY ANY /admin/app/event/{id}/show
admin_app_event_export ANY ANY ANY /admin/app/event/export
admin_sonata_user_user_list ANY ANY ANY /admin/sonata/user/user/list
admin_sonata_user_user_create ANY ANY ANY /admin/sonata/user/user/create
admin_sonata_user_user_batch ANY ANY ANY /admin/sonata/user/user/batch
admin_sonata_user_user_edit ANY ANY ANY /admin/sonata/user/user/{id}/edit
admin_sonata_user_user_delete ANY ANY ANY /admin/sonata/user/user/{id}/delete
admin_sonata_user_user_show ANY ANY ANY /admin/sonata/user/user/{id}/show
admin_sonata_user_user_export ANY ANY ANY /admin/sonata/user/user/export
admin_sonata_user_group_list ANY ANY ANY /admin/sonata/user/group/list
admin_sonata_user_group_create ANY ANY ANY /admin/sonata/user/group/create
admin_sonata_user_group_batch ANY ANY ANY /admin/sonata/user/group/batch
admin_sonata_user_group_edit ANY ANY ANY /admin/sonata/user/group/{id}/edit
admin_sonata_user_group_delete ANY ANY ANY /admin/sonata/user/group/{id}/delete
admin_sonata_user_group_show ANY ANY ANY /admin/sonata/user/group/{id}/show
admin_sonata_user_group_export ANY ANY ANY /admin/sonata/user/group/export
sonata_admin_redirect ANY ANY ANY /admin/
sonata_admin_dashboard ANY ANY ANY /admin/dashboard
sonata_admin_retrieve_form_element ANY ANY ANY /admin/core/get-form-field-element
sonata_admin_append_form_element ANY ANY ANY /admin/core/append-form-field-element
sonata_admin_short_object_information ANY ANY ANY /admin/core/get-short-object-description.{_format}
sonata_admin_set_object_field_value ANY ANY ANY /admin/core/set-object-field-value
sonata_admin_search ANY ANY ANY /admin/search
sonata_admin_retrieve_autocomplete_items ANY ANY ANY /admin/core/get-autocomplete-items
sonata_user_admin_security_login ANY ANY ANY /admin/login
sonata_user_admin_security_check POST ANY ANY /admin/login_check
sonata_user_admin_security_logout ANY ANY ANY /admin/logout
sonata_user_admin_resetting_request GET ANY ANY /admin/resetting/request
sonata_user_admin_resetting_send_email POST ANY ANY /admin/resetting/send-email
sonata_user_admin_resetting_check_email GET ANY ANY /admin/resetting/check-email
sonata_user_admin_resetting_reset GET|POST ANY ANY /admin/resetting/reset/{token}
------------------------------------------ ---------- -------- ------ ----------------------------------------------------









share|improve this question
























  • Could it be a trailing slash issue? Have you tried the path /admin/ (with the forward slash)?
    – Dirk J. Faber
    2 days ago












  • What Symfony version are you using? If you use Symfony 4.x check if you added those routes to config/routes.yaml or config/packages/prod/routes.yaml.
    – GasKa
    2 days ago










  • @DirkJ.Faber No i have the same problem with the forward slash
    – Pilou
    2 days ago










  • @GasKa Yes, I am using Symfony 4.1.7 ok that may be the thing, i'll look around it. Thank you
    – Pilou
    2 days ago










  • @Gaska I have passed the content of my config/packages/sonata_admin.yamlin my config/routes.yaml and just after in a new file config/packages/prod/routes.yaml, but I still have the same problem. I access /admin in local, but not on my server (cleared my cache)
    – Pilou
    2 days ago

















up vote
0
down vote

favorite












I have added a sonata admin to my website.



In local, i can access to the path /admin but not when I push it on my prod environnement. I get a 404 when i try to access it :



Not Found
The requested URL /admin was not found on this server.



I have removed my cache in var/cache/prod



In case heres the content of my sonata_admin.yaml which is used :



_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin

admin_area:
resource: "@SonataAdminBundle/Resources/config/routing/sonata_admin.xml"
prefix: /admin

sonata_user_admin_security:
resource: '@SonataUserBundle/Resources/config/routing/admin_security.xml'
prefix: /admin

sonata_user_admin_resetting:
resource: '@SonataUserBundle/Resources/config/routing/admin_resetting.xml'
prefix: /admin/resetting


Do I have to configure something, to access these paths on my server ? Or does this has anything to do with the .htaccess file.



Any clue of what might be causing this problem ?



Thank you in advance for your help !



UPDATE : Heres what I have when I do debug:router command on my localhost (can't do it in production)



D:website>php bin/console debug:router
------------------------------------------ ---------- -------- ------ ----------------------------------------------------
Name Method Scheme Host Path
------------------------------------------ ---------- -------- ------ ----------------------------------------------------
homepage ANY ANY ANY /
_twig_error_test ANY ANY ANY /_error/{code}.{_format}
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler_open_file ANY ANY ANY /_profiler/open
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
webhook_index ANY ANY ANY /mailchimp/webhook/endpoint
admin_app_event_list ANY ANY ANY /admin/app/event/list
admin_app_event_create ANY ANY ANY /admin/app/event/create
admin_app_event_batch ANY ANY ANY /admin/app/event/batch
admin_app_event_edit ANY ANY ANY /admin/app/event/{id}/edit
admin_app_event_delete ANY ANY ANY /admin/app/event/{id}/delete
admin_app_event_show ANY ANY ANY /admin/app/event/{id}/show
admin_app_event_export ANY ANY ANY /admin/app/event/export
admin_sonata_user_user_list ANY ANY ANY /admin/sonata/user/user/list
admin_sonata_user_user_create ANY ANY ANY /admin/sonata/user/user/create
admin_sonata_user_user_batch ANY ANY ANY /admin/sonata/user/user/batch
admin_sonata_user_user_edit ANY ANY ANY /admin/sonata/user/user/{id}/edit
admin_sonata_user_user_delete ANY ANY ANY /admin/sonata/user/user/{id}/delete
admin_sonata_user_user_show ANY ANY ANY /admin/sonata/user/user/{id}/show
admin_sonata_user_user_export ANY ANY ANY /admin/sonata/user/user/export
admin_sonata_user_group_list ANY ANY ANY /admin/sonata/user/group/list
admin_sonata_user_group_create ANY ANY ANY /admin/sonata/user/group/create
admin_sonata_user_group_batch ANY ANY ANY /admin/sonata/user/group/batch
admin_sonata_user_group_edit ANY ANY ANY /admin/sonata/user/group/{id}/edit
admin_sonata_user_group_delete ANY ANY ANY /admin/sonata/user/group/{id}/delete
admin_sonata_user_group_show ANY ANY ANY /admin/sonata/user/group/{id}/show
admin_sonata_user_group_export ANY ANY ANY /admin/sonata/user/group/export
sonata_admin_redirect ANY ANY ANY /admin/
sonata_admin_dashboard ANY ANY ANY /admin/dashboard
sonata_admin_retrieve_form_element ANY ANY ANY /admin/core/get-form-field-element
sonata_admin_append_form_element ANY ANY ANY /admin/core/append-form-field-element
sonata_admin_short_object_information ANY ANY ANY /admin/core/get-short-object-description.{_format}
sonata_admin_set_object_field_value ANY ANY ANY /admin/core/set-object-field-value
sonata_admin_search ANY ANY ANY /admin/search
sonata_admin_retrieve_autocomplete_items ANY ANY ANY /admin/core/get-autocomplete-items
sonata_user_admin_security_login ANY ANY ANY /admin/login
sonata_user_admin_security_check POST ANY ANY /admin/login_check
sonata_user_admin_security_logout ANY ANY ANY /admin/logout
sonata_user_admin_resetting_request GET ANY ANY /admin/resetting/request
sonata_user_admin_resetting_send_email POST ANY ANY /admin/resetting/send-email
sonata_user_admin_resetting_check_email GET ANY ANY /admin/resetting/check-email
sonata_user_admin_resetting_reset GET|POST ANY ANY /admin/resetting/reset/{token}
------------------------------------------ ---------- -------- ------ ----------------------------------------------------









share|improve this question
























  • Could it be a trailing slash issue? Have you tried the path /admin/ (with the forward slash)?
    – Dirk J. Faber
    2 days ago












  • What Symfony version are you using? If you use Symfony 4.x check if you added those routes to config/routes.yaml or config/packages/prod/routes.yaml.
    – GasKa
    2 days ago










  • @DirkJ.Faber No i have the same problem with the forward slash
    – Pilou
    2 days ago










  • @GasKa Yes, I am using Symfony 4.1.7 ok that may be the thing, i'll look around it. Thank you
    – Pilou
    2 days ago










  • @Gaska I have passed the content of my config/packages/sonata_admin.yamlin my config/routes.yaml and just after in a new file config/packages/prod/routes.yaml, but I still have the same problem. I access /admin in local, but not on my server (cleared my cache)
    – Pilou
    2 days ago















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have added a sonata admin to my website.



In local, i can access to the path /admin but not when I push it on my prod environnement. I get a 404 when i try to access it :



Not Found
The requested URL /admin was not found on this server.



I have removed my cache in var/cache/prod



In case heres the content of my sonata_admin.yaml which is used :



_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin

admin_area:
resource: "@SonataAdminBundle/Resources/config/routing/sonata_admin.xml"
prefix: /admin

sonata_user_admin_security:
resource: '@SonataUserBundle/Resources/config/routing/admin_security.xml'
prefix: /admin

sonata_user_admin_resetting:
resource: '@SonataUserBundle/Resources/config/routing/admin_resetting.xml'
prefix: /admin/resetting


Do I have to configure something, to access these paths on my server ? Or does this has anything to do with the .htaccess file.



Any clue of what might be causing this problem ?



Thank you in advance for your help !



UPDATE : Heres what I have when I do debug:router command on my localhost (can't do it in production)



D:website>php bin/console debug:router
------------------------------------------ ---------- -------- ------ ----------------------------------------------------
Name Method Scheme Host Path
------------------------------------------ ---------- -------- ------ ----------------------------------------------------
homepage ANY ANY ANY /
_twig_error_test ANY ANY ANY /_error/{code}.{_format}
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler_open_file ANY ANY ANY /_profiler/open
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
webhook_index ANY ANY ANY /mailchimp/webhook/endpoint
admin_app_event_list ANY ANY ANY /admin/app/event/list
admin_app_event_create ANY ANY ANY /admin/app/event/create
admin_app_event_batch ANY ANY ANY /admin/app/event/batch
admin_app_event_edit ANY ANY ANY /admin/app/event/{id}/edit
admin_app_event_delete ANY ANY ANY /admin/app/event/{id}/delete
admin_app_event_show ANY ANY ANY /admin/app/event/{id}/show
admin_app_event_export ANY ANY ANY /admin/app/event/export
admin_sonata_user_user_list ANY ANY ANY /admin/sonata/user/user/list
admin_sonata_user_user_create ANY ANY ANY /admin/sonata/user/user/create
admin_sonata_user_user_batch ANY ANY ANY /admin/sonata/user/user/batch
admin_sonata_user_user_edit ANY ANY ANY /admin/sonata/user/user/{id}/edit
admin_sonata_user_user_delete ANY ANY ANY /admin/sonata/user/user/{id}/delete
admin_sonata_user_user_show ANY ANY ANY /admin/sonata/user/user/{id}/show
admin_sonata_user_user_export ANY ANY ANY /admin/sonata/user/user/export
admin_sonata_user_group_list ANY ANY ANY /admin/sonata/user/group/list
admin_sonata_user_group_create ANY ANY ANY /admin/sonata/user/group/create
admin_sonata_user_group_batch ANY ANY ANY /admin/sonata/user/group/batch
admin_sonata_user_group_edit ANY ANY ANY /admin/sonata/user/group/{id}/edit
admin_sonata_user_group_delete ANY ANY ANY /admin/sonata/user/group/{id}/delete
admin_sonata_user_group_show ANY ANY ANY /admin/sonata/user/group/{id}/show
admin_sonata_user_group_export ANY ANY ANY /admin/sonata/user/group/export
sonata_admin_redirect ANY ANY ANY /admin/
sonata_admin_dashboard ANY ANY ANY /admin/dashboard
sonata_admin_retrieve_form_element ANY ANY ANY /admin/core/get-form-field-element
sonata_admin_append_form_element ANY ANY ANY /admin/core/append-form-field-element
sonata_admin_short_object_information ANY ANY ANY /admin/core/get-short-object-description.{_format}
sonata_admin_set_object_field_value ANY ANY ANY /admin/core/set-object-field-value
sonata_admin_search ANY ANY ANY /admin/search
sonata_admin_retrieve_autocomplete_items ANY ANY ANY /admin/core/get-autocomplete-items
sonata_user_admin_security_login ANY ANY ANY /admin/login
sonata_user_admin_security_check POST ANY ANY /admin/login_check
sonata_user_admin_security_logout ANY ANY ANY /admin/logout
sonata_user_admin_resetting_request GET ANY ANY /admin/resetting/request
sonata_user_admin_resetting_send_email POST ANY ANY /admin/resetting/send-email
sonata_user_admin_resetting_check_email GET ANY ANY /admin/resetting/check-email
sonata_user_admin_resetting_reset GET|POST ANY ANY /admin/resetting/reset/{token}
------------------------------------------ ---------- -------- ------ ----------------------------------------------------









share|improve this question















I have added a sonata admin to my website.



In local, i can access to the path /admin but not when I push it on my prod environnement. I get a 404 when i try to access it :



Not Found
The requested URL /admin was not found on this server.



I have removed my cache in var/cache/prod



In case heres the content of my sonata_admin.yaml which is used :



_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin

admin_area:
resource: "@SonataAdminBundle/Resources/config/routing/sonata_admin.xml"
prefix: /admin

sonata_user_admin_security:
resource: '@SonataUserBundle/Resources/config/routing/admin_security.xml'
prefix: /admin

sonata_user_admin_resetting:
resource: '@SonataUserBundle/Resources/config/routing/admin_resetting.xml'
prefix: /admin/resetting


Do I have to configure something, to access these paths on my server ? Or does this has anything to do with the .htaccess file.



Any clue of what might be causing this problem ?



Thank you in advance for your help !



UPDATE : Heres what I have when I do debug:router command on my localhost (can't do it in production)



D:website>php bin/console debug:router
------------------------------------------ ---------- -------- ------ ----------------------------------------------------
Name Method Scheme Host Path
------------------------------------------ ---------- -------- ------ ----------------------------------------------------
homepage ANY ANY ANY /
_twig_error_test ANY ANY ANY /_error/{code}.{_format}
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler_open_file ANY ANY ANY /_profiler/open
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
webhook_index ANY ANY ANY /mailchimp/webhook/endpoint
admin_app_event_list ANY ANY ANY /admin/app/event/list
admin_app_event_create ANY ANY ANY /admin/app/event/create
admin_app_event_batch ANY ANY ANY /admin/app/event/batch
admin_app_event_edit ANY ANY ANY /admin/app/event/{id}/edit
admin_app_event_delete ANY ANY ANY /admin/app/event/{id}/delete
admin_app_event_show ANY ANY ANY /admin/app/event/{id}/show
admin_app_event_export ANY ANY ANY /admin/app/event/export
admin_sonata_user_user_list ANY ANY ANY /admin/sonata/user/user/list
admin_sonata_user_user_create ANY ANY ANY /admin/sonata/user/user/create
admin_sonata_user_user_batch ANY ANY ANY /admin/sonata/user/user/batch
admin_sonata_user_user_edit ANY ANY ANY /admin/sonata/user/user/{id}/edit
admin_sonata_user_user_delete ANY ANY ANY /admin/sonata/user/user/{id}/delete
admin_sonata_user_user_show ANY ANY ANY /admin/sonata/user/user/{id}/show
admin_sonata_user_user_export ANY ANY ANY /admin/sonata/user/user/export
admin_sonata_user_group_list ANY ANY ANY /admin/sonata/user/group/list
admin_sonata_user_group_create ANY ANY ANY /admin/sonata/user/group/create
admin_sonata_user_group_batch ANY ANY ANY /admin/sonata/user/group/batch
admin_sonata_user_group_edit ANY ANY ANY /admin/sonata/user/group/{id}/edit
admin_sonata_user_group_delete ANY ANY ANY /admin/sonata/user/group/{id}/delete
admin_sonata_user_group_show ANY ANY ANY /admin/sonata/user/group/{id}/show
admin_sonata_user_group_export ANY ANY ANY /admin/sonata/user/group/export
sonata_admin_redirect ANY ANY ANY /admin/
sonata_admin_dashboard ANY ANY ANY /admin/dashboard
sonata_admin_retrieve_form_element ANY ANY ANY /admin/core/get-form-field-element
sonata_admin_append_form_element ANY ANY ANY /admin/core/append-form-field-element
sonata_admin_short_object_information ANY ANY ANY /admin/core/get-short-object-description.{_format}
sonata_admin_set_object_field_value ANY ANY ANY /admin/core/set-object-field-value
sonata_admin_search ANY ANY ANY /admin/search
sonata_admin_retrieve_autocomplete_items ANY ANY ANY /admin/core/get-autocomplete-items
sonata_user_admin_security_login ANY ANY ANY /admin/login
sonata_user_admin_security_check POST ANY ANY /admin/login_check
sonata_user_admin_security_logout ANY ANY ANY /admin/logout
sonata_user_admin_resetting_request GET ANY ANY /admin/resetting/request
sonata_user_admin_resetting_send_email POST ANY ANY /admin/resetting/send-email
sonata_user_admin_resetting_check_email GET ANY ANY /admin/resetting/check-email
sonata_user_admin_resetting_reset GET|POST ANY ANY /admin/resetting/reset/{token}
------------------------------------------ ---------- -------- ------ ----------------------------------------------------






.htaccess symfony sonata-admin symfony4 production-environment






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago

























asked 2 days ago









Pilou

408




408












  • Could it be a trailing slash issue? Have you tried the path /admin/ (with the forward slash)?
    – Dirk J. Faber
    2 days ago












  • What Symfony version are you using? If you use Symfony 4.x check if you added those routes to config/routes.yaml or config/packages/prod/routes.yaml.
    – GasKa
    2 days ago










  • @DirkJ.Faber No i have the same problem with the forward slash
    – Pilou
    2 days ago










  • @GasKa Yes, I am using Symfony 4.1.7 ok that may be the thing, i'll look around it. Thank you
    – Pilou
    2 days ago










  • @Gaska I have passed the content of my config/packages/sonata_admin.yamlin my config/routes.yaml and just after in a new file config/packages/prod/routes.yaml, but I still have the same problem. I access /admin in local, but not on my server (cleared my cache)
    – Pilou
    2 days ago




















  • Could it be a trailing slash issue? Have you tried the path /admin/ (with the forward slash)?
    – Dirk J. Faber
    2 days ago












  • What Symfony version are you using? If you use Symfony 4.x check if you added those routes to config/routes.yaml or config/packages/prod/routes.yaml.
    – GasKa
    2 days ago










  • @DirkJ.Faber No i have the same problem with the forward slash
    – Pilou
    2 days ago










  • @GasKa Yes, I am using Symfony 4.1.7 ok that may be the thing, i'll look around it. Thank you
    – Pilou
    2 days ago










  • @Gaska I have passed the content of my config/packages/sonata_admin.yamlin my config/routes.yaml and just after in a new file config/packages/prod/routes.yaml, but I still have the same problem. I access /admin in local, but not on my server (cleared my cache)
    – Pilou
    2 days ago


















Could it be a trailing slash issue? Have you tried the path /admin/ (with the forward slash)?
– Dirk J. Faber
2 days ago






Could it be a trailing slash issue? Have you tried the path /admin/ (with the forward slash)?
– Dirk J. Faber
2 days ago














What Symfony version are you using? If you use Symfony 4.x check if you added those routes to config/routes.yaml or config/packages/prod/routes.yaml.
– GasKa
2 days ago




What Symfony version are you using? If you use Symfony 4.x check if you added those routes to config/routes.yaml or config/packages/prod/routes.yaml.
– GasKa
2 days ago












@DirkJ.Faber No i have the same problem with the forward slash
– Pilou
2 days ago




@DirkJ.Faber No i have the same problem with the forward slash
– Pilou
2 days ago












@GasKa Yes, I am using Symfony 4.1.7 ok that may be the thing, i'll look around it. Thank you
– Pilou
2 days ago




@GasKa Yes, I am using Symfony 4.1.7 ok that may be the thing, i'll look around it. Thank you
– Pilou
2 days ago












@Gaska I have passed the content of my config/packages/sonata_admin.yamlin my config/routes.yaml and just after in a new file config/packages/prod/routes.yaml, but I still have the same problem. I access /admin in local, but not on my server (cleared my cache)
– Pilou
2 days ago






@Gaska I have passed the content of my config/packages/sonata_admin.yamlin my config/routes.yaml and just after in a new file config/packages/prod/routes.yaml, but I still have the same problem. I access /admin in local, but not on my server (cleared my cache)
– Pilou
2 days ago














1 Answer
1






active

oldest

votes

















up vote
0
down vote













Found the solution :



In Symfony 4.x, we need to specify a specific rewrite rule.



I followed the Symfony 4 documentation.
I just needed to do this command to fix it :



composer require symfony/apache-pack


You can also just add this code in a .htaccess file in the public sub-directory of your Symfony project :



<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /index.php/
</IfModule>
</IfModule>


And voilà ! /admin and all subpaths are now accessible on the server.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372887%2fsymfony-path-admin-accessible-in-local-but-404-in-prod-environnement%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Found the solution :



    In Symfony 4.x, we need to specify a specific rewrite rule.



    I followed the Symfony 4 documentation.
    I just needed to do this command to fix it :



    composer require symfony/apache-pack


    You can also just add this code in a .htaccess file in the public sub-directory of your Symfony project :



    <IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
    </IfModule>

    <IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
    RedirectMatch 302 ^/$ /index.php/
    </IfModule>
    </IfModule>


    And voilà ! /admin and all subpaths are now accessible on the server.






    share|improve this answer



























      up vote
      0
      down vote













      Found the solution :



      In Symfony 4.x, we need to specify a specific rewrite rule.



      I followed the Symfony 4 documentation.
      I just needed to do this command to fix it :



      composer require symfony/apache-pack


      You can also just add this code in a .htaccess file in the public sub-directory of your Symfony project :



      <IfModule mod_rewrite.c>
      Options -MultiViews
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(.*)$ index.php [QSA,L]
      </IfModule>

      <IfModule !mod_rewrite.c>
      <IfModule mod_alias.c>
      RedirectMatch 302 ^/$ /index.php/
      </IfModule>
      </IfModule>


      And voilà ! /admin and all subpaths are now accessible on the server.






      share|improve this answer

























        up vote
        0
        down vote










        up vote
        0
        down vote









        Found the solution :



        In Symfony 4.x, we need to specify a specific rewrite rule.



        I followed the Symfony 4 documentation.
        I just needed to do this command to fix it :



        composer require symfony/apache-pack


        You can also just add this code in a .htaccess file in the public sub-directory of your Symfony project :



        <IfModule mod_rewrite.c>
        Options -MultiViews
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ index.php [QSA,L]
        </IfModule>

        <IfModule !mod_rewrite.c>
        <IfModule mod_alias.c>
        RedirectMatch 302 ^/$ /index.php/
        </IfModule>
        </IfModule>


        And voilà ! /admin and all subpaths are now accessible on the server.






        share|improve this answer














        Found the solution :



        In Symfony 4.x, we need to specify a specific rewrite rule.



        I followed the Symfony 4 documentation.
        I just needed to do this command to fix it :



        composer require symfony/apache-pack


        You can also just add this code in a .htaccess file in the public sub-directory of your Symfony project :



        <IfModule mod_rewrite.c>
        Options -MultiViews
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ index.php [QSA,L]
        </IfModule>

        <IfModule !mod_rewrite.c>
        <IfModule mod_alias.c>
        RedirectMatch 302 ^/$ /index.php/
        </IfModule>
        </IfModule>


        And voilà ! /admin and all subpaths are now accessible on the server.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 20 hours ago

























        answered 23 hours ago









        Pilou

        408




        408






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372887%2fsymfony-path-admin-accessible-in-local-but-404-in-prod-environnement%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

            SQL update select statement

            WPF add header to Image with URL pettitions [duplicate]