Jump to content

Problems configuring subdirectory as root


Recommended Posts

Hello,

I have PrestaShop 1.5.4.1 in a sub-directory ("/prestashop") and I want to use it as root directory, so I can have URLs as "www.mysite.com/category/product"

 

I added this .htaccess in the root folder

 

# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.
# Do not change this line - RewriteEngine on
RewriteEngine on
# Change yourdomain.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
# Change 'subfolder' to be the folder you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/prestashop/
# Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subfolder' to be the folder you will use for your main domain.
RewriteRule ^(.*)$ /prestashop/$1
# Change yourdomain.com to be your main domain again.
# Change 'subfolder' to be the folder you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteRule ^(/)?$ prestashop/index.php [L]

 

 

and set the Base URI to "/" in the SEO preferences

 

It seems to work.

URLs are ok.

But there are some problems in the back office.

For example: green save buttons don't work, but save grey input buttons work properly.

For example: when I search for a module, quick results don't appear, I have to click on the Search button.

All asynchronous calls seem to not work.

 

How to solve?

Link to comment
Share on other sites

File: classes/Media.php

 

Methods:

- getCSSPath

- getJSPath

 

If I comment these lines

 

if (Context::getContext()->controller->controller_type == 'admin')
 {
  $js_uri = preg_replace('/^'.preg_quote(__PS_BASE_URI__, '/').'/', '/', $js_uri);
  $js_uri = dirname(preg_replace('/\?.+$/', '', $_SERVER['REQUEST_URI']).'a').'/..'.$js_uri;
 }

 

everything is ok

 

the question is, it's a bug or a workaround for a bad way to configure PrestaShop as root?

Link to comment
Share on other sites

My goal is to have Prestashop in a subfolder, but with URLs such as www.foo.com/category/product

 

I installed PrestaShop into a sub folder (/prestashop),

then created that .htaccess file in the root folder, and changed the Base URI to "/" (instead of "/prestashop/") in the SEO preferences

I only did these steps

Link to comment
Share on other sites

  • 2 weeks later...

File: classes/Media.php

 

Methods:

- getCSSPath

- getJSPath

 

If I comment these lines

 

if (Context::getContext()->controller->controller_type == 'admin')
 {
  $js_uri = preg_replace('/^'.preg_quote(__PS_BASE_URI__, '/').'/', '/', $js_uri);
  $js_uri = dirname(preg_replace('/\?.+$/', '', $_SERVER['REQUEST_URI']).'a').'/..'.$js_uri;
 }

 

everything is ok

 

the question is, it's a bug or a workaround for a bad way to configure PrestaShop as root?

Hi, I had the same problem. And so: how did you solve the matter? by creating that .htacces, setting / as Base URI and editing the file: classes/Media.php ? at the end: Does il works? :) thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...