Magento 2 moving Apache docroot to pub directory - magento2

I've recently performed a Magento security scan and it recommended I move the root of my Magento 2 installation to the pub directory.
I've followed the instructions here but I've had no success. The site fails to find the images and merged CSS files. I have double checked that the CSS files and images exist in their respective directories in pub/static.
My Apache configuration:
DocumentRoot /var/www/html/magento2/pub
ServerName www.somedomainorother.co.uk
ServerAlias somedomainorother.co.uk
<Directory "/var/www/html/magento2/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
I am using Apache 2.4, Centos 7.3.
Has anybody run across a problem like this before and how did you fix it?

I had exactly the same issue and the root cause I found that Magento was still looking for the static resources under [site_url]/pub/static or (if static versioning is enabled):
[site_url]/version[NNNNNN]/pub/static
While they should have been requested according to the new root
[site_url]/version[NNNNNN]/static
I had to check the static and media urls, in core_config_data I found [site_url]/pub/media and [site_url]/pub/static as values for base_media_url, base_static_url for secure and unsecure. I simply removed these config records from core_config_data and left the application to retrieve them correctly by default.

I assume you have tried the usual trick of:
php bin/magento setup:static-content:deploy
You may need to add an '-f' after depending on which mode you are in. Also, if you are using a language different to 'en_US' then you woul dneed to add that at the end. I have to do this:
php bin/magento setup:static-content:deploy -f en_GB
This has helped me get out of those CSS and image screw ups.
Otherwise I would look at maybe it being a permissions issue?

Related

migrating TYPO3 6.2.31 to TYPO3 7.6.23

When I try to migrate my TYPO3 6.2.31 to 7.6.23 I've got some problems.
Especially the page tree is missing so I got this error
The requested resource "%2Fmain" was not found
I've tried this way to migrate:
1.) Copy the whole page
2.) Changing the symlinks to the new sources
3.) Starting the migration wizard in install tool
And now When I want to access the backend I got the above mentioned error.
what can I do?
thanks.
When I call url.de/typo3 the follwing url is called:
index.php?route=%252Fmain&token=XXX
The correct one should be
index.php?route=%2Fmain&token=XXX
What could be the problem in the url?
Please follow below steps.
Download typo3 7 LTS latest source and create symlink.
Add your typo3conf, uploads and fileadmin folder
Open install tools and clear both cache php and typo3.
Compare currentdatabse specification and perform all steps.
Go to upgrade wizard and complete all needed steps
Clear cache and remove typo3temp file and open BE
as mentioned here: Need to allow encoded slashes on Apache
Issue 1: Apache believes that's an invalid url
Solution: AllowEncodedSlashes On in httpd.conf
Issue 2: Apache decodes the encoded slashes
Solution: AllowEncodedSlashes NoDecode in httpd.conf (Requires Apache 2.3.12+)
Issue 3: mod_proxy attempts to re-encode (double encode) the URL changing %2F to
%252F (eg. /example/http:%252F%252Fwww.someurl.com/)
Solution: In httpd.conf use the ProxyPass keyword nocanon to pass the raw URL thru the proxy.
ProxyPass http://anotherserver:8080/example/ nocanon
httpd.conf file:
AllowEncodedSlashes NoDecode
<Location /example/>
ProxyPass http://anotherserver:8080/example/ nocanon
</Location>

Cannot open admin panel of magento 2

After migrating the magento 2 project from localhost to live server, th frontend works fine but cannot open backend(AdminPanel) of magento.
Please Help,
Thanx in advc
Please change Allowoverride none to Allowoverride All in httpd.conf file of your live server.
Enable mod_rewrite on Apache
Clear magento cache
Check URL entries in core_config_data table(for magento2.1)

Seeing "Page Not Found" on Activity, Members, Groups & Blogs tabs

I have installed the latest version of BuddyPress on a WP.
However, the Activity, Members, Groups, and Blogs tabs all show "Page not found" errors. or show me just a title.
Thanks for any help you can provide.
screenshot: http://oi43.tinypic.com/14cw45v.jpg
link here
I had a similar issue just now. All of my buddypress pages (register, activate, members, etc.) were giving me a 404 error. I now have all the pages displaying correctly.
EXPERIENCE
I'm using an amazon EC2 instance, with apache2. My buddypress was version 2.2.1 on wordpress 4.1.1.
My first guess was that the URL wasn't rewriting correctly, so I tried all of the options in settings > permalinks.
Each time I reloaded the page I was trying to access and confirmed that my .htaccess file was being rewritten accordingly.
(.htaccess is in the base directory of your wordpress installation. If it isn't being rewritten by saving wordpress' permalinks options, try chmod-ing the permissions: http://codex.wordpress.org/Changing_File_Permissions).
SOLUTION
I found a solution through the permalinks page of the wordpress codex:
http://codex.wordpress.org/Using_Permalinks
There is an option is a file called httpd.conf on my system that disabled the rewrite module in my .htaccess file. (On a linux system this should be in /etc/httpd/conf. On OSX it should be in /etc/apache2.)
By changing my webserver directory AllowOverride option from None to All, the .htaccess file was able to function properly. Again, I found a line in the section of my httpd.conf file that read:
AllowOverride None
and changed it to:
AllowOverride All
Hope this helps.
Try going to settings/permalinks, and just save them again. Often this resolved 'page not found' errors.

base url dont work on typo3 6.2

i have problem after installing the bootstrap package on my localhost wamp
http://localhost/fileadmin/bsdist/lib/bootstrap/3.2/css/bootstrap.min.css?1419681956
i have added config.baseURL
baseURL = http://localhost/typo3/
/typo3/ is the admin panel you can't set that URL as baseURL. I don't you what happen but i think he will remove that part.
So set your Domain as baseURL and don't forget the / at the end.
baseURL = http://localhost/
don't forget to clear your complete cache to load the changes.
As #Stony already pointed you cannot use .../typo3/ as baseURL because this is location specific for TYPO3's backend.
On the other hand working with TYPO3 in subfolders always rises some problems as you need to change several configs (i.e. in .htaccess for url rewriting) to make it working correctly. And as I last tested clean installation in subfolder doesn't work as expected out-of-the-box.
Fortunately there's simple and elegant solution - creating custom domain locally.
Just in your hosts file add line like
127.0.0.1 myproject.loc
Add a vhost for this myproject.loc in your Apache config
Restart Apache and flush the DNS cache
In such case your project will be available locally at url http://myproject.loc/ so you can use it as well as your baseURL
If the typo3 installation is not in the domain's root directory, you must modify the RewriteBase in the default htaccess:
RewriteBase /<project_directory>
In your case:
RewriteBase /typo3

Sling Dynamic Include with Dispatcher

I was looking over the blog here to understand the concept of SDI+Dispatcher. I enable SSI on apache via using this post & seems it working. But didn't get any material which can demonstrate this concept practically. I am using the same geomatrixx page to where some user logged in and gets cache. How can i store the only static part on the dispatcher cache and how the dynamic component will render at run time. I made changes to my apache conf file as below but now looking over further steps. In blog its also mention to add <!--#include virtual="/includes/header.html" --> so where so i need to add this under body.jsp of page component or somewhere on apache server.
LoadModule dispatcher_module /usr/lib/apache2/modules/dispatcher-apache2.4-4.1.8.so
<IfModule disp_apache2.c>
<!-- Configurations -->
</IfModule>
SetOutputFilter INCLUDES
<Directory />
<IfModule disp_apache2.c>
SetHandler dispatcher-handler
ModMimeUsePathInfo On
</IfModule>
Options FollowSymLinks Includes
AllowOverride None
</Directory>
AND
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride None
Require all granted
</Directory>
Thanks
Sling Dynamic Include automatically replaces components enumerated in the OSGi configuration with the SSI include tag (<!--#include...), so you don't have to write this tag in any JSP.
Open the Apache Felix console, go to the OSGi / Configuration tab and create a new SDI Configuration entry. More information on the configuration properties can be found on the Github. Enter resource types of the components and from this moment (assuming that the dispatcher configuration is OK) they will be replaced with SSI include tags and - as a result - served dynamically even if the whole page is cached.
Aforementioned Github repository contains the most up-to-date documentation of the module.