homepage Welcome to WebmasterWorld Guest from 54.205.144.54
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Multiple .htaccess files under Apache - WordPress
Apache handle multiple .htacesss for RewiteBase
igorberger




msg:3533302
 8:26 am on Dec 22, 2007 (gmt 0)

I tried to post this to an older thread, but it has expired, so starting a new one with refernce to original, being the original was not solved.

[webmasterworld.com...]

I have 2 WordPress instalations and some other rewrites that are pertinent to the top directory and not to WordPress instalations.

This goes into the root dir .htaccess

Options +FollowSymlinks
Rewriteengine on
RewriteCond %{REQUEST_URI}!^/blogtest(.*)$
# You will need to have this for every rule

blogtest dir .htaccess

<IfModule mod_rewrite.c>
Options +FollowSymlinks
Rewriteengine on
RewriteBase /blogtest/
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /blogtest/index.php [L]
</IfModule>

#End

Regards,
Igor

 

phranque




msg:3533342
 12:05 pm on Dec 22, 2007 (gmt 0)

you should reread that thread and make the suggested fixes and report back with what you tried and what response you got.

igorberger




msg:3533350
 12:33 pm on Dec 22, 2007 (gmt 0)

phranque, I did not start the thread origionally, just contributing the solution.

phranque




msg:3533359
 1:00 pm on Dec 22, 2007 (gmt 0)

my bad!
i misunderstood your post.
thanks for the fix - maybe it can be appended by mods to the op...

that root .htaccess seems to be missing a rewriterule.
what results do you get for http://www.example.com/blogtest/?

igorberger




msg:3533363
 1:21 pm on Dec 22, 2007 (gmt 0)

Well that is the trick. If you put the blogtest rewrite in root access, which you can as well, but it is inherit. So if you have two WordPress instalations you better seperate the .htaccess for it all to work properly.

root .htaccess (Here you say rewrite all except blog and blogtest)

blog .htacess gets its own rewrite
blogtest .htaccess gets its own rewrite

http://www.example.com/blogtest/ server header 200 ok

phranque




msg:3533594
 12:17 am on Dec 23, 2007 (gmt 0)

what is the purpose of the RewriteCond in the root dir .htaccess?

igorberger




msg:3533613
 12:44 am on Dec 23, 2007 (gmt 0)

Okay let's say you need to do this

RewriteCond %{REQUEST_URI}!^/blogtest(.*)$
RewriteRule ^(.*)\.jpg$ /images/$1\.jpg

So you still have the two WordPress directories, right?

But you want to rewrite the picture files that are phisically in the images dir to come like this.

http://www.example.com/image.jpg

This is a virtual rewrite so you get 200 ok.

The actual file is in the /images/

That is why you need the condition not to rewite your /blogtest/ otherwise the WordPress instalation rewrite will not work.

There are many reasons to have rewrites in the top dir and sub branches besides the WorPress dir.

Cononical duplication is a very important reason.

Remeber when you have the blog instaled in a sub directory, proper instalation, you still have to deal with home dir root! That is why the condition to exclude the WordPress dir, because of its rewrite!

[edited by: encyclo at 1:57 am (utc) on Dec. 23, 2007]
[edit reason] no links to personal sites please [/edit]

phranque




msg:3533617
 12:54 am on Dec 23, 2007 (gmt 0)

that root .htaccess seems to be missing a rewriterule.

Okay let's say you need to do this

RewriteCond %{REQUEST_URI}!^/blogtest(.*)$
RewriteRule ^(.*)\.jpg$ /images/$1\.jpg

ok maybe it wasn't missing - just hidden or implied...

igorberger




msg:3533624
 1:10 am on Dec 23, 2007 (gmt 0)

Yes that was implied in the comment.

RewriteCond %{REQUEST_URI}!^/blogtest(.*)$ (this says exclude /blogtest dir)
# You will need to have this for every rule

Tell me if you have a spesific rewrite that you are interested in doing and I will try to help you hack it.

https to http
not www to www
mail sub domain to www

etc.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved