Link to home
Start Free TrialLog in
Avatar of sharingsunshine
sharingsunshineFlag for United States of America

asked on

Need Woocommerce Posts Content To Show

Woocommerce db just moved to a new Amazon instance.  Did mysqldump of old instance and then import via mysql.  The backoffice comes up the pages show but when you try to view them this error shows

https://gyazo.com/6a19c26d8530df1b2d98e82253534dd6

This is a snapshot of the posts table.  As you can see there are over 50,000 entries.

https://gyazo.com/2fb664b3a1b2acaa0f55bce5bc6f0612

Please let me know what to do I am down completely.
ASKER CERTIFIED SOLUTION
Avatar of Adrian Thompson
Adrian Thompson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sharingsunshine

ASKER

changing it to plain, allows me to access the site.
perfect! if you now change it to "post name" and click save, Word Press should automatically update your .htaccess file with the necessary settings so it will continue to work as before with the user-friendly URLs.

Please let me know if this works?

If it does not work it is because Word Press cannot automatically update your .htaccess file in which case I can help you to update it manually.
permalink-postname.JPG
there was something in the custom base too, but I didn't write it down.  Should I still go ahead and save?
after pressing save it doesn't work.
Yes you can click save because it won't do any harm and you can change it anytime.

There are also permalink options for "products". You can set this to anything you like but if you are unsure, use "default".

If you decide to change the base URL later, you can click "Custom Structure" and type the following:

/mybaseurl/%postname%/

Two possible examples could be:
/blog/%postname%/
/mysection/%postname%/
You said "after pressing save it doesn't work" ... please can you tell me what happens?

Also please can you send me a copy of your .htaccess file (attach it to your comment)

You mentioned - there was something in the custom base too, but I didn't write it down. Regarding the products, these are default:

User generated image
It is possible the file permissions on your new Amazon Instance are "read only" which will stop Word Press from updating your .htaccess file. Please check that write access is also granted.

The following permalink rewrite code should be included in your .htaccess file. This is included by Word Press automatically but you can insert it manually if necessary:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

See this page for more detail:
https://codex.wordpress.org/Using_Permalinks#Creating_and_editing_.28.htaccess.29
click section 3.2 Creating and editing (.htaccess)

If you make sure that "write access" is available to the root folder of your WordPress installation, this should not be required as it is done automatically when you save your permalink options.
I have a copy of the table from the original instance before the move.  Which I will add

a:5:{s:12:"product_base";s:8:"/product";s:13:"category_base";s:16:"product-category";s:8:"tag_base";s:11:"product-tag";s:14:"attribute_base";s:0:"";s:22:"use_verbose_page_rules";b:1;}

Open in new window


and the other one is
https://gyazo.com/22054dadfc0a3f5d10ad48974a14dd8f

they both are from wp_options

this is what I mean by custom base - https://gyazo.com/af9287059018bb0cba9a8aca933c83ce
[root@ip-172-31-8-214 theherbsplace.com]# cat .htaccess
# BEGIN W3TC Browser Cache
<IfModule mod_mime.c>
    AddType text/css .css
    AddType text/x-component .htc
    AddType application/x-javascript .js
    AddType application/javascript .js2
    AddType text/javascript .js3
    AddType text/x-js .js4
    AddType video/asf .asf .asx .wax .wmv .wmx
    AddType video/avi .avi
    AddType image/bmp .bmp
    AddType application/java .class
    AddType video/divx .divx
    AddType application/msword .doc .docx
    AddType application/vnd.ms-fontobject .eot
    AddType application/x-msdownload .exe
    AddType image/gif .gif
    AddType application/x-gzip .gz .gzip
    AddType image/x-icon .ico
    AddType image/jpeg .jpg .jpeg .jpe
    AddType image/webp .webp
    AddType application/json .json
    AddType application/vnd.ms-access .mdb
    AddType audio/midi .mid .midi
    AddType video/quicktime .mov .qt
    AddType audio/mpeg .mp3 .m4a
    AddType video/mp4 .mp4 .m4v
    AddType video/mpeg .mpeg .mpg .mpe
    AddType application/vnd.ms-project .mpp
    AddType application/x-font-otf .otf
    AddType application/vnd.ms-opentype ._otf
    AddType application/vnd.oasis.opendocument.database .odb
    AddType application/vnd.oasis.opendocument.chart .odc
    AddType application/vnd.oasis.opendocument.formula .odf
    AddType application/vnd.oasis.opendocument.graphics .odg
    AddType application/vnd.oasis.opendocument.presentation .odp
    AddType application/vnd.oasis.opendocument.spreadsheet .ods
    AddType application/vnd.oasis.opendocument.text .odt
    AddType audio/ogg .ogg
    AddType application/pdf .pdf
    AddType image/png .png
    AddType application/vnd.ms-powerpoint .pot .pps .ppt .pptx
    AddType audio/x-realaudio .ra .ram
    AddType image/svg+xml .svg .svgz
    AddType application/x-shockwave-flash .swf
    AddType application/x-tar .tar
    AddType image/tiff .tif .tiff
    AddType application/x-font-ttf .ttf .ttc
    AddType application/vnd.ms-opentype ._ttf
    AddType audio/wav .wav
    AddType audio/wma .wma
    AddType application/vnd.ms-write .wri
    AddType application/font-woff .woff
    AddType application/font-woff2 .woff2
    AddType application/vnd.ms-excel .xla .xls .xlsx .xlt .xlw
    AddType application/zip .zip
</IfModule>
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css A31536000
    ExpiresByType text/x-component A31536000
    ExpiresByType application/x-javascript A31536000
    ExpiresByType application/javascript A31536000
    ExpiresByType text/javascript A31536000
    ExpiresByType text/x-js A31536000
    ExpiresByType video/asf A31536000
    ExpiresByType video/avi A31536000
    ExpiresByType image/bmp A31536000
    ExpiresByType application/java A31536000
    ExpiresByType video/divx A31536000
    ExpiresByType application/msword A31536000
    ExpiresByType application/vnd.ms-fontobject A31536000
    ExpiresByType application/x-msdownload A31536000
    ExpiresByType image/gif A31536000
    ExpiresByType application/x-gzip A31536000
    ExpiresByType image/x-icon A31536000
    ExpiresByType image/jpeg A31536000
    ExpiresByType image/webp A31536000
    ExpiresByType application/json A31536000
    ExpiresByType application/vnd.ms-access A31536000
    ExpiresByType audio/midi A31536000
    ExpiresByType video/quicktime A31536000
    ExpiresByType audio/mpeg A31536000
    ExpiresByType video/mp4 A31536000
    ExpiresByType video/mpeg A31536000
    ExpiresByType application/vnd.ms-project A31536000
    ExpiresByType application/x-font-otf A31536000
    ExpiresByType application/vnd.ms-opentype A31536000
    ExpiresByType application/vnd.oasis.opendocument.database A31536000
    ExpiresByType application/vnd.oasis.opendocument.chart A31536000
    ExpiresByType application/vnd.oasis.opendocument.formula A31536000
    ExpiresByType application/vnd.oasis.opendocument.graphics A31536000
    ExpiresByType application/vnd.oasis.opendocument.presentation A31536000
    ExpiresByType application/vnd.oasis.opendocument.spreadsheet A31536000
    ExpiresByType application/vnd.oasis.opendocument.text A31536000
    ExpiresByType audio/ogg A31536000
    ExpiresByType application/pdf A31536000
    ExpiresByType image/png A31536000
    ExpiresByType application/vnd.ms-powerpoint A31536000
    ExpiresByType audio/x-realaudio A31536000
    ExpiresByType image/svg+xml A31536000
    ExpiresByType application/x-shockwave-flash A31536000
    ExpiresByType application/x-tar A31536000
    ExpiresByType image/tiff A31536000
    ExpiresByType application/x-font-ttf A31536000
    ExpiresByType application/vnd.ms-opentype A31536000
    ExpiresByType audio/wav A31536000
    ExpiresByType audio/wma A31536000
    ExpiresByType application/vnd.ms-write A31536000
    ExpiresByType application/font-woff A31536000
    ExpiresByType application/font-woff2 A31536000
    ExpiresByType application/vnd.ms-excel A31536000
    ExpiresByType application/zip A31536000
</IfModule>
<IfModule mod_deflate.c>
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon image/webp application/json application/vnd.ms-access application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.presentation application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint image/svg+xml application/x-shockwave-flash image/tiff application/x-font-ttf application/vnd.ms-opentype audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel
    <IfModule mod_mime.c>
        # DEFLATE by extension
        AddOutputFilter DEFLATE js css htm html xml
    </IfModule>
    </IfModule>
</IfModule>
<FilesMatch "\.(css|htc|less|js|js2|js3|js4|CSS|HTC|LESS|JS|JS2|JS3|JS4)$">
    FileETag MTime Size
    <IfModule mod_headers.c>
         Header unset Set-Cookie
    </IfModule>
</FilesMatch>
<FilesMatch "\.(html|htm|rtf|rtx|svg|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|SVG|TXT|XSD|XSL|XML)$">
    FileETag MTime Size
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
</FilesMatch>
<FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|webp|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|_ttf|wav|wma|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|AVI|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|WEBP|JSON|MDB|MID|MIDI|MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|MPP|OTF|_OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|_TTF|WAV|WMA|WRI|WOFF|WOFF2|XLA|XLS|XLSX|XLT|XLW|ZIP)$">
    FileETag MTime Size
    <IfModule mod_headers.c>
         Header unset Set-Cookie
    </IfModule>
</FilesMatch>
<FilesMatch "\.(bmp|class|doc|docx|eot|exe|ico|webp|json|mdb|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|pot|pps|ppt|pptx|svg|svgz|swf|tif|tiff|ttf|ttc|_ttf|wav|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|BMP|CLASS|DOC|DOCX|EOT|EXE|ICO|WEBP|JSON|MDB|MPP|OTF|_OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|POT|PPS|PPT|PPTX|SVG|SVGZ|SWF|TIF|TIFF|TTF|TTC|_TTF|WAV|WRI|WOFF|WOFF2|XLA|XLS|XLSX|XLT|XLW)$">
    <IfModule mod_headers.c>
         Header unset Last-Modified
    </IfModule>
</FilesMatch>
<IfModule mod_headers.c>
    Header set Referrer-Policy ""
</IfModule>
# END W3TC Browser Cache
# BEGIN WordPress

# END WordPress

Open in new window

when I hit save it comes back to the same error we had before.
https://gyazo.com/6a19c26d8530df1b2d98e82253534dd6
Thanks for posting your .htaccess file. At the end of your .htaccess file is the following:

# BEGIN WordPress

# END WordPress

Open in new window


Change this to:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Open in new window


This is probably caused due to read only permissions in the root directory or read only permissions on the .htaccess file itself.
I am not real strong on permissions.  The path is /data/web/theherbsplace.com/[wordpress files]

It is 775 recursive from /data

the user is ec2-user:apache does it need to be owner apache too?  By the way, plugins can't be updated either.

/data, /web, /theherbsplace.com have the GID set too.
changed the .htaccess and changed to post name and saved it and this error came up.

https://gyazo.com/24365a83bf06cb43080d9ec016f0a446

changed back to plain and I get the weird url but it works.
To get your site up and running, please can you modify your .htaccess file as I showed above?

We can then look at fixing permissions so you can update plugins and so on.
That is surprising because we have certainly identified the problem. Did the .htaccess file definitely save? For example, the .htaccess file may not have saved your changes perhaps again due to file permission issues. Also, did you try more than one link as it is possible you have a genuine 404 not found error on that link in your screenshot.

This article should help you with permissions:
https://serverfault.com/questions/844452/cant-edit-files-in-amazon-lightsail

Are you using Amazon Lightsale?
https://aws.amazon.com/documentation/lightsail/?id=docs_gateway
no apache with linux 2

that page is good because on plain it comes up.

it didn't save - where do I look for this write issue.
this is good because the issue is now clearly identified - you said it didn't save the .htaccess file. Therefore when we fix the write issue we can be sure everything will work fine (although you will still need to go back into your permalink settings and choose "post name" and hit save again.

So regarding the write issue -

775 for your permissions is correct but as you say, it might not be recursive. To make sure it is recursive, you need to use the "recursive option" -R in your console command like this:

chmod -R 777 /mydirectory

Please replace /mydirectory in the above command with the root directory of your website.

By the way, we are using 777 here as a test because these are full read and write permissions for everyone. After we get it working, you can reduce this back to 775 which removes "public write access".
did the recursive 777

updated .htaccess and made sure it was there

picked post name in permalinks and pressed save and still came back to same error I had originally.
Now you have done this, please can you do the following:

1. In WordPress Permalinks enter the following options:
Common Settings: Post name
Optional: Product category base: product-category
Optional: Product tag base: product-tag
Product Permalinks: Default

2. Click "Save Changes"

3. Send me a copy of your .htaccess file, before changing anything else

Thanks
I cleared the cache but no change.  I then changed permalinks and pressed save and still have same problem.  But, I went to the .htaccess and wordpress had removed your changes for some reason.
Oh and when you do the above, please leave your website as it is for a few minutes. I will then go and take a quick look:

https://www.theherbsplace.com
Ah I did not know you have a Cache. Until this is fixed, you should disable the Cache.
it's ready for you
disabled cache
Have you been able to look at the site enough?
give me 10 minutes please. thanks
certainly, just let me know when you are done.
okay I've taken a look. Please can we try the following:

1. Disable the CACHE
2. Make sure your permalink settings are as I described above
3. Make a backup of your existing .htaccess file
4. Create a new empty .htaccess file with the following content:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Open in new window



Let me know if this works
the changes are made
getting same error
Please can you now check the .htaccess file has definitely saved correctly? ... and can you check the CACHE is disabled?
cache plugin has been disabled completely

your .htaccess is saved

there is a plugin that does some redirects when it finds prestashop urls and converts them over to woocommerce urls - it is enabled because it won't redirect those links if its not turned on.

https://www.fredericgilles.net/fg-prestashop-to-woocommerce/

the redirects are in the db

do you want me to turn it off
good idea. you can disable the plugin for now yes. it can always be re-enabled later
it's deactivated
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Let me know when you published the /test/ page - make sure it is a "page" and not a "product"
it's done.

Not Found

The requested URL /test was not found on this server.
Are you sure this is a Linux server and not a Windows server?

The reason I ask is because if you are sure the .htaccess file has the code I gave you earlier, it makes no sense to get this issue. Windows uses web.config instead of .htaccess

We know your Word Press installation is working because changing the permalinks to "plain" works fine. Therefore it is definitely a rewrite issue. Originally you said the .htaccess file did not save properly so if you are definitely on Linux it looks like it has still not saved properly. It is also important to make sure the filename is exactly ".htaccess" and not simply "htaccess"

If you have verified all of this, try the following - delete the .htacess file and then go into WordPress and hit "Save Changes" in the Permalinks page (change it to plain and save then change it back to "post name" and "default" and save again). WordPress should then recreate the .htaccess file for you. If it does not, then we are back to the file permission problems discussed earlier in which case you need to check the root folder AND files are set to CHMOD 777.

I'm afraid that's all I have time for today.

We have successfully identified your issue is "Permalink Settings" because you changed these to "Plain" and it works. We then determined you have an issue with file permissions and I explained you need to use the command chmod -R 777 /mydirectory as a test then change permissions back to 775 after it is working.

If you do all of this and if you are on a Linux system then it should work.

While this is unresolved, you can put the permalink option back to "Plain" so at least all of your pages will load. I feel the CHMOD is still not correct, because WordPress will manage everything for you if it has full write access.

As a final option, I am an expert and very very fast at setting up websites in Microsoft Azure (takes 1 hour to setup a server plus 10 minutes to setup a WordPress website including database). If you sign up for a £10 / month server and give me Microsoft RDP access (Remote Desktop), I can get this site running for you on Monday if you have a ZIP of the MySQL Export and a ZIP of the files. You can then delete my RDP access when its live. If you follow my instructions in this post this should not be needed but this option is available as a last resort, should everything else fail.

In future, it is always good to run a test on a new server before migrating to ensure you don't run into problems. Then you are not rushing to fix a live website. Something to keep in mind...

I'll be available again on Monday although I will check back sooner if I have time.

I hope my remarks have been helpful.
thanks for what you have done and let me know.  It is definitely linux and as you can see it is 777 from /data on https://gyazo.com/479ba4176f204fc5960a07606ab5f3d7

regarding .htaccess it is there - https://gyazo.com/7f479072d0912892f5c3d25fd2e09eec

I hope to have it fixed sooner than Monday but I will keep in mind your offer.
Thanks. Also make sure you are working on the correct .htaccess file - it should be located in the same directory as your wordpress files.

Have a nice evening!
I've got it - if you are sure your file permissions are correct then it must be the following:

- You need to enable the rewrite_module in the Apache configuration

When this is enabled it will work ;-)
I normally work on Windows machines but the concept is the same. I just remembered that on Linux you need to enable the rewrite_module in the Apache configuration, so that will be the missing part of the puzzle. It is the only thing we have not checked.
knowing to switch it to plain was very helpful.  For anyone having problems with permissions on wordpress this is the best I have found:
https://www.stevejenkins.com/blog/2015/09/correct-permissions-for-wordpress/

I checked on modrewrite and it is enabled.  But that got me to wondering if the .htaccess was being acted upon and it wasn't.  In httpd.conf there was directory and it said AllowOverride None.  I changed it to AllowOverride All and it all began to work.

Thanks for sticking with me on this.