1

I've installed Magento into a subfolder /var/www/html/magento2 When I access it I need to type http://xxx.xxx.xxx.xxx/magento2

How is it possible to navigate to site without using the subfolder ? Is this related to .htaccess file, I have not edited nor moved files around yet.

Thanks

3 Answers3

2

Edit your .htaccess file in your root folder(/var/www/html/) with below code.

# Mod Rewrite
Options +FollowSymLinks  #Include this line if you are using Godaddy hosting
RewriteEngine On
RewriteCond %{REQUEST_URI} !(.*)subfolder
RewriteRule ^(.*)$ subfolder/$1 [L]

In your case replace subfolder with magento2. Its working for me, check once.

Venu Joginpally
  • 309
  • 4
  • 22
0

if you are using xampp then run your xampp control panel click the button saying config select apache( httpd.conf ) otherwise edit httpd.conf find document root replace

DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">

Those 2 lines

| C:/xampp/htdocs == current location for root |

|change C:/xampp/htdocs with any location you want|

save it and restart xampp

Ashar Riaz
  • 1,035
  • 1
  • 14
  • 34
0

I wrote a post about this link -> post

As everything goes through the /pub/ folder, you need to create /pub/subfolder and then change the relative path on the index.php file:

From: require realpath(DIR) . ‘/../app/bootstrap.php’;

To: require realpath(DIR) . ‘/../../app/bootstrap.php’;

It worked to me with Nginx and Magento 2.2

JokiRuiz
  • 145
  • 2