i have a page in wordpress called “video”. its page id is 6, and its slug is “video”
in my theme ive set it up to show content based on GET variables
here is the URL rewrite im trying to set up:
heres the original URL with the GET variables inside:
mysite.com/video/?video_id=102230&video_title=FC+Emmen+v+AGOVV+Apeldoorn&video_src=MTAyMjMw
heres the URL i want it rewritten to so it can be indexed:
mysite.com/video/102230/MTAyMjMw/FC+Emmen+v+AGOVV+Apeldoorn
heres my htaccess file that is not working:
# BEGIN WordPress
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^video/(.*)/(.*)/(.*)$ ?page_id=6&7video_id=$1&video_src=$2&video_title=$3 [NC]
</ifmodule>
# END WordPress
what happens is, when i try and visit mysite.com/video/102230/MTAyMjMw/FC+Emmen+v+AGOVV+Apeldoorn, it simply automatically goes to mysite.com/video and removes everything after /video
edit – now it is not removing everything after /video, but its telling me “Nothing found for Video 102230 MTAyMjMw FC+Emmen+v+AGOVV+Apeldoorn”
You can do this with WordPress’ built-in rewrite system.
Didn’t test it, but I think this should work.
What is does is first adding tags that you can use in your template (get_query_var(video_id)). Then add a rewriterule that specifically matches the URL.
You should put this code in your functions.php and then flush your rewriterules (go to setting > permalinks).
More info about rewriterules for WordPress:
http://codex.wordpress.org/Rewrite_API
http://codex.wordpress.org/Rewrite_API/add_rewrite_tag
http://codex.wordpress.org/Rewrite_API/add_rewrite_rule