Server Fault Asked by PixelPaul on December 5, 2021
Can someone please explain how i can get nginx to reocgnise a store view in magento under it’s own sub folder.
i have a store.. with the following code in my nginx config file.
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param MAGE_RUN_CODE edu_default;
fastcgi_param MAGE_RUN_TYPE store;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 256k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME /home/domain here/public_html$fastcgi_script_name;
}
i have all my magento files in the root folder: /home/domain here/public_html
now i have a store view that can be accessed via a sub folder /substore/
But i want it to run from the root folder magento index.php file.
But still have all links have the sub folder in the URL.
the actual magento store view configuration is setup correct. So the Base URL and Base Link URL are the URL with the subfolder.
all the static content still loads from the root domain without the subfolder fine.
now i have been trying to do a new location {} block for it but can’t seem to get it to work
i know of the syslink method but want to try not to do that way.
really i just need to find out how to make all /subfolder/index.php urls rewrite to the root index.php file in magento while passing on the MAGE_RUN_CODE
i have just tried this location block under the above one. the url seems to work now but i am getting 404 pages in magento. so mustn’t be passing the “which page to show” values correctly
location ~ /subfolder/.+.php$ {
root /home/domainhere/public_html;
fastcgi_split_path_info ^(.+.php)(/.+)$;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param MAGE_RUN_CODE storeviewcodehere;
fastcgi_param MAGE_RUN_TYPE store;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 256k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME /home/domainhere/public_html$fastcgi_script_name;
UPDATE .1
okay so i found out that i need to use the section…
location @handler {
rewrite / /subfolder/index.php;
}
but that stops the top level store not working as everything become the sub store view.
so i need to have rewrite rules for
rewrite / /index.php;
and
rewrite / /subfolder/index.php;
anyone know the correct way to do this?
ive seen this many times, why to keep multiple shops in separate subfolders, isnt it a subdomain work??
the correct way is to keep your shop as is, and using dropdown menu select your store view, and change base url....
then in nginx you maybe need to use map
configuration,
map $request_uri $mage_code {
default edu_default;
~^/my_other_shop/ edu_special;
}
map $request_uri $mage_type {
default edu_default;
~^/my_other_shop/ store;
}
in fact i have never tried that before :)
Answered by ADM on December 5, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP