dombrorj Posted August 18, 2010 Share Posted August 18, 2010 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! Quote Link to comment https://forums.phpfreaks.com/topic/211118-mod-rewrite-to-directory-wont-work/ Share on other sites More sharing options...
dombrorj Posted August 18, 2010 Author Share Posted August 18, 2010 Shoot! Sorry, wrong forum. This should be under the Apache forum. Sorry 'bout that, but can still use the help if anyone knows. Quote Link to comment https://forums.phpfreaks.com/topic/211118-mod-rewrite-to-directory-wont-work/#findComment-1101017 Share on other sites More sharing options...
jcbones Posted August 19, 2010 Share Posted August 19, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/211118-mod-rewrite-to-directory-wont-work/#findComment-1101044 Share on other sites More sharing options...
dombrorj Posted August 19, 2010 Author Share Posted August 19, 2010 Thanks jcbones. That does the trick, without the images. It's a small page, so I'll just move the images to the same directory as index.html, and that should do it. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/211118-mod-rewrite-to-directory-wont-work/#findComment-1101441 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.