• Hi all, another question about mod_rewrite rules in my site https://www.sahw.com/wp

    I used to work with the following mod_rewrite rules. They worked fine when I was using WordPress 1.2. This were the contents of my former .htaccess file:

    RewriteEngine On
    RewriteBase /wp/
    RewriteRule ^archivos/category/(.*)/(feed|rdf|rss|rss2|atom)/?$

    /wp/wp-feed.php?category_name=$1&feed=$2 [QSA]
    RewriteRule ^archivos/category/?(.*) /wp/index.php?category_name=$1 [QSA]
    RewriteRule ^archivos/author/(.*)/(feed|rdf|rss|rss2|atom)/?$

    /wp/wp-feed.php?author_name=$1&feed=$2 [QSA]
    RewriteRule ^archivos/author/?(.*) /wp/index.php?author_name=$1 [QSA]
    RewriteRule

    ^archivos/([0-9]{4})?/?([0-9]{1,2})?/?([0-9]{1,2})?/?([_0-9a-z-]+)?/?([0-9]+)?/?$

    /wp/index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA]
    RewriteRule

    ^archivos/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([_0-9a-z-]+)/(feed|rdf|rss|rss2|atom)/?$

    /wp/wp-feed.php?year=$1&monthnum=$2&day=$3&name=$4&feed=$5 [QSA]
    RewriteRule ^archivos/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([_0-9a-z-]+)/trackback/?$

    /wp/wp-trackback.php?year=$1&monthnum=$2&day=$3&name=$4 [QSA]
    RewriteRule ^feed/?([_0-9a-z-]+)?/?$ /wp/wp-feed.php?feed=$1 [QSA]
    RewriteRule ^comments/feed/?([_0-9a-z-]+)?/?$ /wp/wp-feed.php?feed=$1&withcomments=1 [QSA]

    Now, I?′ve updated to 1.5.1.2 and the new structure that WP suggests is:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wp/
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ – [S=35]
    RewriteRule ^feed/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?&feed=$1 [QSA,L]
    RewriteRule ^(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?&feed=$1 [QSA,L]
    RewriteRule ^page/?([0-9]{1,})/?$ /wp/index.php?&paged=$1 [QSA,L]
    RewriteRule ^comments/feed/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?&feed=$1&withcomments=1 [QSA,L]
    RewriteRule ^comments/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?&feed=$1&withcomments=1 [QSA,L]
    RewriteRule ^comments/page/?([0-9]{1,})/?$ /wp/index.php?&paged=$1 [QSA,L]
    RewriteRule ^search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?s=$1&feed=$2 [QSA,L]
    RewriteRule ^search/(.+)/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?s=$1&feed=$2 [QSA,L]
    RewriteRule ^search/(.+)/page/?([0-9]{1,})/?$ /wp/index.php?s=$1&paged=$2 [QSA,L]
    RewriteRule ^search/(.+)/?$ /wp/index.php?s=$1 [QSA,L]
    RewriteRule ^archivos/category/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^archivos/category/(.+)/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^archivos/category/(.+)/page/?([0-9]{1,})/?$ /wp/index.php?category_name=$1&paged=$2 [QSA,L]
    RewriteRule ^archivos/category/(.+)/?$ /wp/index.php?category_name=$1 [QSA,L]
    RewriteRule ^archivos/author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^archivos/author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^archivos/author/([^/]+)/page/?([0-9]{1,})/?$ /wp/index.php?author_name=$1&paged=$2 [QSA,L]
    RewriteRule ^archivos/author/([^/]+)/?$ /wp/index.php?author_name=$1 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?year=$1&feed=$2 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?year=$1&feed=$2 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/page/?([0-9]{1,})/?$ /wp/index.php?year=$1&paged=$2 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/?$ /wp/index.php?year=$1 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?year=$1&monthnum=$2&feed=$3 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?year=$1&monthnum=$2&feed=$3 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$ /wp/index.php?year=$1&monthnum=$2&paged=$3 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/([0-9]{1,2})/?$ /wp/index.php?year=$1&monthnum=$2 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$ /wp/index.php?year=$1&monthnum=$2&day=$3&paged=$4 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /wp/index.php?year=$1&monthnum=$2&day=$3 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?year=$1&monthnum=$2&day=$3&name=$4&feed=$5 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /wp/index.php?year=$1&monthnum=$2&day=$3&name=$4&feed=$5 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/page/?([0-9]{1,})/?$ /wp/index.php?year=$1&monthnum=$2&day=$3&name=$4&paged=$5 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$ /wp/index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA,L]
    RewriteRule ^archivos/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$ /wp/index.php?year=$1&monthnum=$2&day=$3&name=$4&tb=1 [QSA,L]
    </IfModule>

    Both mod?§_rewrite structures do not work any longer. Any help on this?

    Thanks in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • 1. Do not post long code here. Use https://pastebin.com/

    2. They worked fine when I was using WordPress 1.2.
    Delete it (the .htaccess file) and let WP 1.5.1.2 create a new one.

    Thread Starter slyedtech

    (@slyedtech)

    Delete it (the .htaccess file) and let WP 1.5.1.2 create a new one.

    I?′ve deleted it, but WP does not create a new one once I?′ve updated my permalink structure. Folder was chmod 777. Any hint?

    Sorry about long code paste.

    Moderator James Huff

    (@macmanx)

    Thread Starter slyedtech

    (@slyedtech)

    I?′ve fixed the .htaccess generation following your instructions, macmanx, but I get permanent 404 errors when browsing my archives.

    I have not changed the structure: it?′s still the same

    II used /archivos/%year%/%monthnum%/%day%/%postname%/ in version 1.2 and I?′m rewriting using /archivos/%year%/%monthnum%/%day%/%postname%/ in 1.5.2.1

    What could be happening?

    Moderator James Huff

    (@macmanx)

    Can you confirm that WordPress is writing to the .htaccess file?

    Thread Starter slyedtech

    (@slyedtech)

    Yes indeed, I can perfectly read in my .htaccess file:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wp/

    … the rules and conditions …

    </IfModule>

    # END WordPress

    Once it?′s written, should I return .htaccess to 644 ? Must it be with another permissions ? I?′ve edited it using chmod 666

    Thread Starter slyedtech

    (@slyedtech)

    I can also confirm that 404 appears ONLY when %postname% appears:

    Links that work prefectly:

    /archivos/%year%/
    /archivos/%year%/%monthnum%/
    /archivos/%year%/%monthnum%/%day%/

    Links that DON?′T work

    /archivos/%year%/%monthnum%/%day%/%postname%/

    I?′ve got a plugin working since 1.2 “Sanitize MT” that sanitizes post title, but it worked perfectly with my former ReWrite rules.

    Thread Starter slyedtech

    (@slyedtech)

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Mod_rewrite problems after updating to 1.5.1.2’ is closed to new replies.