Quote Originally Posted by shags38 View Post
v1.5.5f PHP7.1 CEON uri mapping - IH - and others (previously reported in this thread July 26 with no responses https://www.zen-cart.com/showthread....16#post1360016)

When adding new products in configuration/catalogue/products/new_product I am getting the following problem.

Problem. 404 error: When I add a new product then go to the site the product is there in category/listing but when clicking on it to go to product/info page I get a 404 error 'this resource is not available on this server' i.e. a blank page, not the default ZC 404 page.

the box at the bottom of the create product page is ticked by default for auto generation of url - if I add a product and untick the CEON automatic uri generation box the product loads and works as it should on the site (it then has a generic ZC url).

I have checked and re-checked the CEON installation and configuration using the inbuilt checking and all is OK - I even added the "/" in front of index as suggested - "Try adding a slash to the front of index.php, this may resolve the problem: RewriteRule .* /index.php [QSA,L]" but that made no difference.

notes:
1. another site (former site) is wildcard redirected to this new site
2. this new site is an exact clone of the former site, i.e. all folders are exactly the same and so is the data base (renamed)
3. site works seamlessly except for adding new products
4. .htaccess which I thought may be an issue is an exact copy from another site that also is a clone site that is also widcard redirected - so same same - and that site does not have the new product creation issue
5. I have in fact rolled back the site to a saved copy pre redirection above

I do not want to reinstall CEON because I will lose all existing mapped urls

So looking for some ideas here please.

cheers,
Mike

.htaccess file

HTML Code:
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^index\.php$ - [L]

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

###############################################################################
# Add any other directives relating to the handling of physical files
###############################################################################
# Notes:
#
# If processing makes it this far, the request was for a real file or folder.
# Example: Adding further processing related to browser caching or security.
###############################################################################
<IfModule mod_security.c>
    SecFilterScanPOST Off
</IfModule>

###############################################################################

## BEGIN CEON URI MAPPING REWRITE RULE

RewriteEngine On

# Don't rewrite any URIs ending with a file extension (ending with .[xxxxx])
# Don't rewrite any URIs for some, popular specific file format extensions,
#   which are not covered by main file extension condition above
# Don't rewrite any URIs for some specific file format extensions,
#   which are not covered by main file extension condition above
#   Uncomment the following line to apply this condition! (Remove the # at the start of the next line)
#RewriteCond %{REQUEST_URI} !\.(3gp|3g2|h261|h263|mj2|mjp2|mp4v|mpg4|m1v|m2v|m4u|f4v|m4v|3dml)$ [NC]
# Don't rewrite admin directory
# Don't rewrite editors directory
# Don't rewrite bmz_cache directory
# Don't rewrite .well-known directory
# Don't rewrite teststore directory
# Don't rewrite cgi-bin directory
# Don't rewrite zc_install_done directory
# Don't rewrite blog directory
# Don't rewrite logs directory
# Don't rewrite sitemap directory
# Don't rewrite temp directory
# Handle all other URIs using Zen Cart (its index.php)
RewriteCond %{REQUEST_URI} !\.[a-zA-Z]{2,5}$ [OR]
RewriteCond %{REQUEST_URI} \.(html)$ [NC]
RewriteCond %{REQUEST_URI} !\.(mp3|mp4|h264)$ [NC]
RewriteCond %{REQUEST_URI} !^/dazzlers [NC]
RewriteCond %{REQUEST_URI} !^/editors/ [NC]
RewriteCond %{REQUEST_URI} !^/bmz_cache/ [NC]
RewriteCond %{REQUEST_URI} !^/\.well\-known/ [NC]
RewriteCond %{REQUEST_URI} !^/teststore/ [NC]
RewriteCond %{REQUEST_URI} !^/cgi\-bin/ [NC]
RewriteCond %{REQUEST_URI} !^/zc_install_done/ [NC]
RewriteCond %{REQUEST_URI} !^/blog/ [NC]
RewriteCond %{REQUEST_URI} !^/logs/ [NC]
RewriteCond %{REQUEST_URI} !^/sitemap/ [NC]
RewriteCond %{REQUEST_URI} !^/temp/ [NC]
RewriteRule .* /index.php [QSA,L]

## END CEON URI MAPPING REWRITE RULE

###############################################################################

## Optional caching improvements
## Requires mod_header and mod_deflate to be enabled within Apache
##################

##################
## Optional caching improvements
## Requires mod_header and mod_deflate to be enabled within Apache
##################
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<IfModule mod_deflate.c>
  <FilesMatch "(?i)\.(js|css)$">
    SetOutputFilter DEFLATE
  </FilesMatch>
</IfModule>

##################
## Optional improvements
## Requires mod_expires to be enabled within Apache
##################
## EXPIRES HEADER CACHING ##
 <IfModule mod_expires.c>
 ExpiresActive On
 ExpiresByType image/jpg "access 1 year"
 ExpiresByType image/jpeg "access 1 year"
 ExpiresByType image/gif "access 1 year"
 ExpiresByType image/png "access 1 year"
 ExpiresByType text/css "access 1 month"
 ExpiresByType application/pdf "access 1 month"
 ExpiresByType application/javascript "access 1 month"
 ExpiresByType application/x-javascript "access 1 month"
 ExpiresByType application/x-shockwave-flash "access 1 month"
 ExpiresByType image/x-icon "access 1 year"
 ExpiresDefault "access 7 days"
 </IfModule>
 ## EXPIRES HEADER CACHING

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php70” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php70 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
In review of other .htaccess rules I have seen and had to implement, a possible alternative RewriteRule line could be:
Code:
RewriteRule ^(.*)$ /index.php [QSA,L]
or
Code:
RewriteRule ^(.*)$ index.php [QSA,L]
The problem described certainly appears to be related to the .htaccess file where the installation check seems to just offer a recommended .htacess file based on a few minor factors, not necessarily guaranteed to work on the specific server.

As an aside, it appears that the admin directory has been published for all to see. Would recommend that the admin directory be renamed both on the server and in the .htaccess file.

Now there are also a number of other questions that have gone unanswered: what version of Ceon URI Mapping is being used, is the site in a sub-directory as seen in a web-browser? Why are some of the other RewriteCond statements in the installation check not included?