rewrite URL to blog

Discuss practical ways rearrange URLs using mod_rewrite.

rewrite URL to blog

Postby gaxunil » Mon Oct 12, 2009 4:48 pm

Hi Everyone,
This seems like it should be an easy problem, but I'm stumped on it.

I'm on apache 2.2.8

I have "/" mounted to tomcat via mod_jk so most things go to tomcat.
I have /blog unmounted and it is served by wordpress with the standard .htaccess file in the blog directory for nice permalinks.

What I want to do is map a simple URL to a certain blog page:
http://www.mysite.com/foo -> http://www.mysite.com/blog/foo-page-long-name

I would rather have an internal redirect / rewrite so that I'm not doing a browser redirect, and so the page stays as http://www.mysite.com/foo in the browser.

I've tried lots of different things and nothing seems to be working. Some things get me to wordpress, but then I get a 404 from wordpress.

A browser redirect works, but I'd rather not use this solution.
RewriteRule ^/foo /blog/foo-page-long-name [L,R-301]

These get me into the blog, but I get a 404 from wordpress. I don't know what URI wordpress is actually seeing to give me that 404
RewriteRule ^/foo /blog/foo-page-long-name
RewriteRule ^/foo /blog/foo-page-long-name [L]
RewriteRule ^/foo /blog/foo-page-long-name [PT]

I would be grateful for any ideas or suggestions.
Thanks
-John
gaxunil
 
Posts: 1
Joined: Mon Oct 12, 2009 4:36 pm

Postby richardk » Tue Oct 13, 2009 2:15 am

Wordpress uses the REQUEST_URI variable which will be set to /foo and cannot be changed by mod_rewrite.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 0 guests

cron