Jump to content

mod rewrite to directory won't work


dombrorj

Recommended Posts

I've been working on this for several hours, and I know its something you guys can do in about 3 seconds. So hoping you don't mind helping me out here...

 

I have the following code, which is not quite working:

 

RewriteCond %{HTTP_HOST} ^mysite.com
RewriteRule ^vote/(.*)$  wp-content/blogs.dir/2/vote/$1 [L]

 

I'm trying to load the index.html page in mysite.com/wp-content/blogs.dir/2/vote load by using mysite.com/vote, but I get a 404 - page not found. The only way it sort of works is if I go to mysite.com/vote/index.html. Even then, it doesn't load any of the images (which are stored one level deeper in an 'images' directory: mysite.com/wp-content/blogs.dir/2/vote).

 

 

 

Any thoughts on what I'm doing wrong here?

 

It may be important to note that Wordpress is installed on the root directory.

 

Thanks!

Link to comment
Share on other sites

Using mod-rewrite, you may have to provide full URL's to your images, as they pass through the re-writer also, (as data calls from the client's browser).  However, to get it to show with only "mysite.com/vote" you need to change your rule.

 

RewriteRule ^vote/(.*)$  wp-content/blogs.dir/2/vote/$1 [L]

 

The above code is checking for the word "vote" then a slash(/) then any more characters before the end of the string.  This would return valid for "mysite.com/vote/index.html", but not valid for "mysite.com/vote".

 

RewriteRule ^vote$ wp-content/blogs.dir/2/vote/index.html [L]

 

The code above will evaluate true for "mysite.com/vote", but not true for "mysite.com/vote/index.html".

 

You could get it to work both ways with more complex regex patterns, but I'll leave that for the Apache or Regex forums.  As I am no regex guru.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.