Custom permalink gives 404 error only in some pages

admin2025-06-06  7

Some pages of my Wordpress don't work after creating a custom permalink for products URL in my localhost environment. Home page works, but for example /contact page returns 404. If I look at Apache log, it appears a 404 from /contact. My environment is with WAMP and Windows 10.

I have tried the most common things I have read like:

  1. Enable mod_rewrite.
  2. Modify httpd.conf with:

    <Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    
  3. Reset permalinks to default and change back as desired.

  4. Delete .htaccess.

  5. And also:

    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    

mod_rewrite is enabled, Wordpress have permission to edit .htaccess and if I delete .htaccess and recreate permalinks, htaccess is created again.

My permalinks are %parent_category% and %keyword%, so URL for products are: .../parent_category/keyword/product-name.

For %parent_category%, I get the parent category of the product (WooCommerce) and for %keyword% I get it from Yoast SEO keyword field of the product.

What else can I check?

Some pages of my Wordpress don't work after creating a custom permalink for products URL in my localhost environment. Home page works, but for example /contact page returns 404. If I look at Apache log, it appears a 404 from /contact. My environment is with WAMP and Windows 10.

I have tried the most common things I have read like:

  1. Enable mod_rewrite.
  2. Modify httpd.conf with:

    <Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    
  3. Reset permalinks to default and change back as desired.

  4. Delete .htaccess.

  5. And also:

    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    

mod_rewrite is enabled, Wordpress have permission to edit .htaccess and if I delete .htaccess and recreate permalinks, htaccess is created again.

My permalinks are %parent_category% and %keyword%, so URL for products are: .../parent_category/keyword/product-name.

For %parent_category%, I get the parent category of the product (WooCommerce) and for %keyword% I get it from Yoast SEO keyword field of the product.

What else can I check?

Share Improve this question asked Oct 31, 2018 at 0:25 SergioSergio 1012 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

At the end it was because I wasn't writing a product base. So, after writing a product base like /product/%parent_category%/%keyword% everything worked fine. Besides, I used a plugin called Woocommerce Permalink Manager to remove the "product" from the URL.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749205856a317249.html

最新回复(0)