magento multistore subfolder without symlinks - magento

It's possible to setup a magento multistore with subfolders/subdirectories without need of create symlinks?
For example:
www.mainstore
www.mainstore/store1
www.mainstore/store2
www.mainstore/store3
Some hosting providers have disabled the symlinks for security reasons, and the normal method is making one folder for each store in the magento root foolder, copy in them index.php and .htaccess and make symlinks to all the other magento folders, like this:
ln -s /home/example/example.com/html/app/ app
ln -s /home/example/example.com/html/includes/ includes
ln -s /home/example/example.com/html/js/ js
ln -s /home/example/example.com/html/lib/ lib
ln -s /home/example/example.com/html/media/ media
ln -s /home/example/example.com/html/skin/ skin
ln -s /home/example/example.com/html/var/ var
I think that maybe is possible with .htaccess rewritings, but I don't know how I can setup this.
thanks for your help! :)

Take a look # Magento Multi store setup sub folders
To setup multi store using the same folder using .htaccess.
After setting up your stores in magento update your .htaccess file
SetEnvIf Host www\.store1\.com MAGE_RUN_CODE=base
SetEnvIf Host www\.store1\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^store1\.com MAGE_RUN_CODE=base
SetEnvIf Host ^store1\.com MAGE_RUN_TYPE=website
SetEnvIf Host www\.store2\.com MAGE_RUN_CODE=store2
SetEnvIf Host www\.store2\.com MAGE_RUN_TYPE=store
SetEnvIf Host ^store2\.com MAGE_RUN_CODE=store2
SetEnvIf Host ^store2\.com MAGE_RUN_TYPE=store
Read more #
Multi-Site, Multi-Domain Setup
Setting Up MAGENTO with Multiple Websites or store

Related

How to move from example.com to app.example.com

I have a Laravel app running on AWS LightSail LAMP stack by bitnami. The site is accessible from example.com. Now I want to move that app from example.com to app.example.com . The example.com will later be used to serve company profile/ product portfolio marketing purposes.
The current codebase is under /opt/bitnami/apache/htdocs/ directory, not in any subdirectory.
My queries are:
How do I achieve the above explained domain structure so that in future i can add more subdomains if necessary?
Do I need to make any changes in the DNS records?
Bitnami engineer here!
By default, the server is configured to dispatch the contents in the /opt/bitnami/apache/htdocs/ directory when accessing it.
Having said that, I usually like to leave that path for the main application (or the main domain in your case) and set up another directory for sub-applications, /opt/bitnami/projects/PROJECT_NAME (I'll be using sub, which stands for subapp 🙂).
$ sudo mkdir -p /opt/bitnami/project/sub/htdocs
# Add the code of your sub site here
$ sudo cat | sudo tee index.html > /dev/null << EOF
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
EOF
In order to add more subdomains you need to create new VirtualHosts (in /opt/bitnami/apache/conf/vhosts/) that will handle the requests matching those specific subdomains. The stack comes with sample files for VirtualHosts, so you only need to copy and tailor them to your needs:
$ cd /opt/bitnami/apache/conf/vhosts/
$ sudo cp sample-vhost.conf.disabled sub-vhost.conf
$ sudo cp sample-https-vhost.conf.disabled sub-https-vhost.conf
Edit those files to set the ServerAlias directive to match your subdomain and you should be ready to go!
$ cat sub-vhost.conf
<VirtualHost 127.0.0.1:80 _default_:80>
ServerAlias sub.myapp.com
...

Up laravel project and get (The requested URL /icons/create was not found on this server.) but route exist and any route works perfectly

Running a project in dev server run perfectly but I try to move on a live server, I got "The requested URL /icons/create was not found on this server."
i got that just in 1 route in : .../icon/create
but any route works fine.
this is my htaccess :
I try to composer dump-autoload in local but don't get any error"
or something problem in my htaccess file?
mod_rewrite already enable in the apache web server.
Very thank you, if someone wants to help me :)
as u r saying u have "mod_rewrite already enable"
try this editing /etc/apache2/sites-enabled/000-default or /etc/apache2/apache2.conf
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Change the AllowOverride None to AllowOverride All
Comment Alias in /etc/apache2/mods-available/alias.conf.
<IfModule alias_module>
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
# We include the /icons/ alias for FancyIndexed directory listings. If
# you do not use FancyIndexing, you may comment this out.
# Alias /icons/ "/usr/share/apache2/icons/"
# <Directory "/usr/share/apache2/icons">
# Options FollowSymlinks
# AllowOverride None
# Require all granted
# </Directory>
</IfModule>
After Comment these lines check apache conf using this command:
sudo apache2ctl -t
Then reload apache2:
sudo systemctl reload apache2

How to setup multiple stores on different domain in magento?

I am working on magento 1.7 version.
I have a store on domain say domain1.com and it is working.
Now I want add another domain as a multiple store say domain2.com
I created website,store,storeview from admin and change base url of newly created store(domain2.com).
I copied index.php and .htaccess file from domain1.com to domain2.com root folder.
And add following lines in .htaccesss file of domain2.com:-
SetEnvIf Host www\.domain2\.com MAGE_RUN_CODE=domain2
SetEnvIf Host www\.domain2\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^domain2\.com MAGE_RUN_CODE=domain2
SetEnvIf Host ^domain2\.com MAGE_RUN_TYPE=website
And index.php file of domain2.com is:-
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
But when I run domain2.com it gives me error like:-
/home/httpd/vhosts/domain2.com/httpdocs/app/Mage.php was not found
Please help me sort out this problem.
This sounds like a hosting issue - domain2.com doesn't look to be pointing to the same folder as domain1.com.
You can link folders on linux like this:
$ cd /home/httpd/vhosts/
$ ln -sf domain1.com domain2.com

Wordpress localhost doesn't show front-end

Can't see the front end of my wordpress localhost.
The process I've done:
1. I installed wordpress locally with BitNami on Mac OX.
2. imported an existing data base to the phpmyadmin.
3. changed the wp-config file to support the local host database.
4. added these two lines
define('WP_HOME','http://localhost/wordpress');
define('WP_SITEURL','http://localhost/wordpress');
5. logged in to my wp-admin.
Now I can see the site's WP-ADMIN and do things in it BUT I cannot view the front end.
whenever I try i get:
can't establish a connection to the server at 127.0.0.1.
or if i try to view a post i get
"The requested URL /site/2013/02/13/idho_global/ was not found on this server."
If I'm trying to preview a draft I see it the way it should appear.
any help?
Check the database via phpmydmin and change the url if you didn't do it.
In the wp_options check if siteurl & home are set to localhost
Update : you should have a look to the 'Moving Wordpress page' https://codex.wordpress.org/Moving_WordPress
It explains very well ho to change permalinks and things to do after moving a Wordpress.
If your permalinks don't works, check if you have a .htaccess in the root directory. The content should be :
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
You need to update the database urls. Wordpress hardcodes them. Run the sql below replacing "old-url.com/wordpress" and "new-url.com/wordpress" with your urls
UPDATE wp_posts SET guid = REPLACE(guid, 'old-url.com/wordpress', 'new-url.com/wordpress');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'old-url.com/wordpress', 'new-url.com/wordpress');
UPDATE wp_options SET option_value = REPLACE(option_value, 'old-url.com/wordpress', 'new-url.com/wordpress');

Multiple Ruby apps on one port, RackBaseURI help

I'm trying to get two Ruby apps to work from the same port. I don't know server technology at all, so forgive my ignorance. I've tried to follow this doc:
http://www.modrails.com/documentation/Users%20guide%20Apache.html
sections 4.1 - 4.3, but I keep messing something up. I've tried to simplify a little, so here is my situation. I have two simple rackup apps here:
/Users/dan/webapps/test1
/Users/dan/webapps/test2
They each have the "config.ru" file, the public/ folder, and the tmp/ folder with "restart.txt", as directed. They both work on their own.
I have the following in my httpd.conf file:
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Users/dan/webapps
<Directory /Users/dan/webapps>
Allow from all
</Directory>
RackBaseURI /test1
<Directory /Users/dan/webapps/test1>
Options -MultiViews
</Directory>
RackBaseURI /test2
<Directory /Users/dan/webapps/test2>
Options -MultiViews
</Directory>
</VirtualHost>
I start apache, and then put this in my browser: http://localhost/test1. I get:
Forbidden
You don't have permission to access /test1 on this server.
I'm not surprised it doesn't work, because I am supposed to set up a symlink but I don't know how to apply that to my setup. Here is the example from the doc:
ln -s /webapps/rackapp/public /websites/phusion/rack
Can you tell me how to set up the symlinks, and let me know if you see anything else wrong? Please give the "for dummies" answer, this stuff boggles my mind. Thanks!
To create the symlinks, try this:
ln-s /Users/dan/webapps/test1 /Users/dan/webapps/test1/public
ln-s /Users/dan/webapps/test2 /Users/dan/webapps/test2/public
However, as chris polzer mentioned, you should also check that your apache user can read from those directories.
If you don't know how to do that, then post the output of these commands:
ls -l /Users/dan/webapps/test1
ls -l /Users/dan/webapps/test2.
ps -aux | grep http
ps -aux | grep apache
You may also need to check the permissions of all parent directories. I.e. /Users, /Users/dan, and /Users/dan/webapps. See: http://www.modrails.com/documentation/Users%20guide%20Apache.html#_deploying_to_a_virtual_host_8217_s_root_2
phylae, I think you may have the paths reversed in the symbolic link. To get it working, I changed the link names for clarity:
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Users/dan/webapps
<Directory /Users/dan/webapps>
Allow from all
</Directory>
RackBaseURI /test1link
<Directory /Users/dan/webapps/test1>
Options -MultiViews
</Directory>
RackBaseURI /test2link
<Directory /Users/dan/webapps/test2>
Options -MultiViews
</Directory>
</VirtualHost>
and then, the symbolic links:
ln -s /Users/dan/webapps/test1/public /Users/dan/webapps/test1link
ln -s /Users/dan/webapps/test2/public /Users/dan/webapps/test2link
Then these urls work as expected in a browser.
http://localhost/
http://localhost/test1link
http://localhost/test2link

Resources