Restrict Content for only Contributors via .htaccess

You can create a custom page template for downloads and use something similar to the following: if (current_user_can(‘contributor’)) { echo “<h2>Download Page</h2>”; } else { echo ‘You do not have access to this page”; } You would need additional code to show the file you are offering for download. Alternatively you could set another cookie … Read more

Simple URL rewriting gone wrong

First I would take it out from the WordPress block rules, as it will be overwrited when permalinks are refreshed if you don’t add the rule to Rewrite API. Then you could add at the bottom of your htaccess something like: Redirect 301 feed/sejururi.xml http://yoursite.com/feed/

Enabling XSendFile causes 404 for images on WordPress Multisite / Network

It wasn’t a .htaccess problem, but an apache configuration problem. On a Mac server you need to: compile XSendFile as a universal binary: apxs -cia -Wc,”-arch i386 -arch x86_64″ -Wl,”-arch i386 -arch x86_64″ mod_xsendfile.c and modify the site specific httpd.conf file in /Library/Server/Web/Config/apache2/sites. If you’re having the same problem, I wrote about this on my … Read more

How to redirect WP post with a specific word in the URL

Try using wp_rewrite: add_action(‘init’, ‘flush_rewrite_rules’); function custom_add_rewrite_rules( $wp_rewrite ) { $new_rules = array( ‘archive/(\d+)’ => ‘/?p=’ . $wp_rewrite->preg_index(1) ); $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } add_action(‘generate_rewrite_rules’, ‘custom_add_rewrite_rules’); Use the plugin activation hook for the flush_rewrite_rules, because you only want this to happen all the time while developing. In production this should only happen when activating … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)