Forums

Custom mod_rewrite rules (5 posts)

  1. pianist0521992
    Member
    Posted 3 years ago #

    Hi. I hope this problem hasn't been solved, but I researched for quite some time and I found this solution for custom mod_rewrite rules.

    I am currently using the rules below, but when I go to rewritten URL, it displays a 404 error.

    <ifmodule mod_rewrite.c>
    AddType application/x-httpd-php .xml
    
    Options +FollowSymLinks -MultiViews 
    
    RewriteEngine On
    RewriteBase /
    RewriteRule ^folio/view/(.+)/?$ /?go=view&id=$1 [L]
    RewriteRule ^folio/(.+)/?$ /?z=$1 [L]
    </ifmodule>
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    I apologize if there is already a solution for this.

  2. Otto
    Tech Ninja
    Posted 3 years ago #

    It's hard to say why you're getting the error without knowing what it is that you're trying to actually do and what URL you're actually using.

    Rewrite rules can be tricky devils. :)

  3. pianist0521992
    Member
    Posted 3 years ago #

  4. Otto
    Tech Ninja
    Posted 3 years ago #

    Try taking off the [L] on your two rules. Either that, or add "index.php" before their ? marks.

  5. pianist0521992
    Member
    Posted 3 years ago #

    I tried both separately and combined, and it unfortunately did not work. Thanks for your suggestion!

Topic Closed

This topic has been closed to new replies.

About this Topic