Welcome to WebmasterWorld Guest from 54.144.79.200

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Multiple .htaccess files under Apache - WordPress

Apache handle multiple .htacesss for RewiteBase

     

igorberger

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

5+ Year Member



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

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

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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

igorberger

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

5+ Year Member



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

phranque

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

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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

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

5+ Year Member



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

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

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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

igorberger

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

5+ Year Member



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

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

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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

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

5+ Year Member



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.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month