• Resolved maxormark

    (@maxormark)


    For legacy reasons, I have to run WordPress alongside a PrestaShop installation.

    All works fine until I switch on friendly URLs when I either find that most of the Prestashop pages don’t appear or I get 403 errors or weird pages instead of the blog posts.

    This has to be the .htaccess file and the MOD REWRITE rules (about which I have little understanding)

    My current .htaccess file is

    RewriteEngine On
    
    # BEGIN WordPress
    
    ## <IfModule mod_rewrite.c>
    RewriteBase /blog.php/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog.php/index.php [L]
    ## </IfModule>
    
    # END WordPress
    
    # BEGIN PrestaShop URL rewriting rules
    RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$2$4 [L,E]
    RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$1$3 [L,E]
    RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1 [QSA,L,E]
    RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ cms.php?id_cms=$1 [QSA,L,E]
    RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?id_supplier=$1$3 [QSA,L,E]
    RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]
    
    # Catch 404 errors
    ErrorDocument 404 /404.php
    
    # END PrestaShop URL rewriting rules

    I’m sure if you get MED REWRITE, the answer is screaming at you. Can you get it to scream at me?

    m

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    It’s not screaming at me, but try moving the WordPress portion to after the PrestaShop section. And of course, make a backup of your .htaccess file before you start editing it just in case.

    Also if you want WordPress to handle your 404 pages, the comment out that ErrorDocument line.

    Thread Starter maxormark

    (@maxormark)

    I did that, well wordpress did that, first of all: put the WP portion at the END of the file.

    This was where I finally got fed up trying to make it work.

    thanks for the input …

    Thread Starter maxormark

    (@maxormark)

    With a little old-fashioned experimentation and a lttle luck I expect we’ve found a set-up which works …

    # URL rewriting module activation
    
    	RewriteEngine On
    
    # BEGIN WordPress
    
       <IfModule mod_rewrite.c>
    
    	RewriteBase /
    	RewriteCond %{REQUEST_FILENAME} !-f
    	RewriteCond %{REQUEST_FILENAME} !-d
    
    	RewriteRule ^(blog)/? blog.php [L]
    
    </IfModule>
    
    # END WordPress
    
    # BEGIN PrestaShop URL rewriting rules
    
    	RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$2$4 [L,E]
    	RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$1$3 [L,E]
    	RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1 [QSA,L,E]
    
    	RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ cms.php?id_cms=$1 [QSA,L,E]
    	RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?id_supplier=$1$3 [QSA,L,E]
    	RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]
    
    # Catch 404 errors
    	ErrorDocument 404 /404.php
    
    # END PrestaShop URL rewriting rules

    Not at all sure how it works, just that it does

    Thanks for your attention

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress and Prestashop MOD REWRITE’ is closed to new replies.