Completely stuck on rewrite rules
-
Hi there,
I know, this is another rewrite post but i tried everything that i cuold find on the forums.
WordPress is setup with permalinks, the settings are:
custom: /%category%/%post_name%/Ive added a page on my site and named it products, in this page i inlcude a php file that processes the query string.
The query string is actualy quit simple and has only one variable: categorieI want to accomplish that this url:
https://mydomain/products/something/ ==> https://mydomain/products/?categorie=somethingI tried to add a rule directly in tha htaccess file:
RewriteEngine On RewriteBase / RewriteRule ^products/(.*)/ products/?categorie=$1 [L] #uploaded files RewriteRule ^(.*/)?files/$ index.php [L] RewriteCond %{REQUEST_URI} !.*wp-content/plugins.* RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L] # add a trailing slash to /wp-admin RewriteCond %{REQUEST_URI} ^.*/wp-admin$ RewriteRule ^(.+)$ $1/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule . - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L] <IfModule mod_security.c> <Files async-upload.php> SecFilterEngine Off SecFilterScanPOST Off </Files> </IfModule>
This resulted in a 404 or when i replace ‘something’ with a page or post name that exists that page or post is shown.
The second thing i tried was a plugin:
function my_rewrite_rules( $rewrite_rules ) { $new_rules = array( '^/producten/(.*)/' => '^/products/?itemId=$1'); $rewrite_rules = $new_rules + $rewrite_rules; return $rewrite_rules; } add_filter('rewrite_rules_array', 'my_rewrite_rules');
Afther isntallation i flushed the current rules by re-saving my permalink setting.
The results where the same, 404 or when ‘something’ is an existing page or post name, that one will show up.Please give me some pointers. My frustration is getting a solid form ??
- The topic ‘Completely stuck on rewrite rules’ is closed to new replies.