Articles of mod rewrite

Using custom mod_rewrite without breaking wordpress permalinks

I am using a theme that uses posts for multiple pages, and the blog posts goes in a category called “blog”, I am using the permalinks setting “/%postname%”, and the blog menu url is “/category/blog”, how can I rewrite that to “/blog” without breaking the rest of the wp url rewrites?, my htaccess is the […]

Evaluating a external rewrite rule before internal wordpress rewrite rule

I am been plucking out my hairs since last few days trying to solve this problem: I want to convert my urls from format to to start with I added following rules to my .htaccess RewriteRule ^prodsearch/(.*)/(.*)-(.*)$ prodsearch/$1/$2+$3 [L] RewriteCond %{REQUEST_URI} !^prodsearch/(.*?)/(.*)\-(.*) RewriteRule ^prodsearch/(.*)/(.*)$ index.php?tag=$2&cat=$1 [R,QSA,L] Here rule1 recursively replaces all ‘-‘ between […]

add new permalink structure from dynamic page

I created page “play” url: http://localhost/myweb/play and inside of page “play” I include PHP code to make the new search from outside WordPress. And all worked, if I search from my page “play” the url will be: http://localhost/myweb/play?m=text+Search&pageno=1 Now, I want my search result url to be fancy url, like: http://localhost/myweb/play_text_Search_1.html I have tried several […]

How to protect media directory with .htaccess?

I am trying to protect the uploads directory with .htacess. But when I browse media section in admin panel, I see user/pass popup. My guess is, WordPress use fopen to find if the file exists. I found mod_rewrite rule allowing fopen but I can’t figure out how to use those rules with basic HTTP authentication. […]

Using custom post type parent as slug

I’m currently using the plugin ‘Types Custom Post Type’ to create custom post types (I know it’s pretty easily done through functions.php but I was feeling a bit lazy!). Basically, I’m looking to have the following format for pages: /wellbean-cottage/ – the main page for a house /wellbean-cottage/things-to-do/ – a child page with information about […]

How to rewrite WordPress uploads folder to another folder using htaccess

I found that the following code online could be used to spoof the WordPress uploads folder, rewriting URLs to a different folder on the server: # BEGIN Spoof wp-content/uploads directory RedirectMatch 301 ^/uploads/(.*)$ https?://$1 # END Spoof wp-content/uploads directory It is my understanding that under Media settings page the ‘Full Path to files’ needs to […]

WordPress mod_rewrite is canceling/overwriting my other mod_rewrite rule

in /www/ I have an .htaccess file containing: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^([^.]*\.less)$ compilers/lessphp.php?file=$1 [R,QSA,L] </ifModule> This code works fine, until I’m requesting .less files in /www/blog/, where WordPress is located, and has its own .htaccess file which contains the standard pretty permalinks mod_rewrite: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog/ RewriteRule ^index\.php$ […]

Should I enable FastCGI on WordPress?

I am looking at my server settings and these are as follows: WebDav : active FastCGI : inactive SSL support : active Perl as Apache module : CGI-Programm PHP module : CGI-Programm Memory usage : 131072 kB Process timeout : 60 seconds Maximum simultaneous processes : 1024 Using WP-Supercache (mod-rewrite mode) and have around 6,000 […]

Can WordPress be installed at the root level, if a homepage called index.php already exists?

Can WordPress be installed at the root level, if a homepage called index.php already exists?

404 when fetching image from wp-content/uploads/

I get 404 status when fetching images, and the http still contains that image. Image shows up in a browser, but the 404 code breaks some applications. calls to wp-content/uploads/ are redirected in .htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteRule (.*) /index.php?getfile=$1 [L] </IfModule> Why do I get a 404 […]