Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite help for Wordpress site

         

adam_se1

2:44 pm on Apr 3, 2007 (gmt 0)

10+ Year Member



Hi,

apologies in advance, I have looked at tutorials and examples but cant seem to get this to work! Hoping a kind soul on here can lend a few brain cells.

I have wordpress installation which is situated in a /blog/ folder, with a homepage at the root.
We have some wordpress "pages" which are displayed as static content. Currently, the URL to these pages is oursite.com/blog/portfolio.
What we want is for these pages to have a url like oursite.com/portfolio, i.e take out the /blog/ bit.

I have tried to adapt the current .htaccess file but with no success. Here is what I have so far:


<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /
RewriteCond %{REQUEST_URI}!^blog/portfolio
RewriteRule ^portfolio$ blog/portfolio

# original wordpress generated bit below:

RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /blog/index.php [L]

</IfModule>

Any help much appreciated!

Thanks
A.

jdMorgan

2:59 pm on Apr 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> Currently, the URL to these pages is oursite.com/blog/portfolio. What we want is for these pages to have a url like oursite.com/portfolio [...]

I assume that you mean, "What we want is for these pages to have a url like oursite.com/portfolio/<something>"


RewriteRule ^portfolio(/.*)?$ /blog/portfolio$1 [L]

The RewriteCond is not needed in this case, since "blog" won't match a pattern for "portfolio."

Now modify your blog to produce on-page links to "/portfolio/<something>, and combined with that RewriteRule, you'll get the results you want.

Jim