rewrite
-
Hey everyone, I have a short rewrite situation. I’m trying to rewrite all calls to a page. Let me illustrate. I’d like all calls that are children of my files page
URL/files/filename
to get changed intoURL/files/?file=filename
.What I’m trying to do is clean up the URLs so that I don’t have links linking back to my theme directory in my page source, it would just link to the files page and then with a little PHP magic it’ll fetch the file from the theme directory for me.
Here’s what I have but it doesn’t seem to be working. Thoughts?
function file_rewrite_rules($wp_rewrite) { $new_rules = array('files/(.+)/?$' => 'index.php?pagename=files&file=$matches[1]'); $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } // Hook in. add_filter('generate_rewrite_rules', 'file_rewrite_rules');
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘rewrite’ is closed to new replies.