Welcome to WebmasterWorld Guest from 54.225.18.67

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Multiple .htaccess files under Apache - WordPress

Apache handle multiple .htacesss for RewiteBase

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

Junior Member

10+ Year Member

joined:July 12, 2007
posts: 54
votes: 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

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

Administrator

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

joined:Aug 10, 2004
posts:10888
votes: 72


you should reread that thread and make the suggested fixes and report back with what you tried and what response you got.
12:33 pm on Dec 22, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:July 12, 2007
posts: 54
votes: 0


phranque, I did not start the thread origionally, just contributing the solution.
1:00 pm on Dec 22, 2007 (gmt 0)

Administrator

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

joined:Aug 10, 2004
posts:10888
votes: 72


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/?

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

Junior Member

10+ Year Member

joined:July 12, 2007
posts: 54
votes: 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

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

Administrator

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

joined:Aug 10, 2004
posts:10888
votes: 72


what is the purpose of the RewriteCond in the root dir .htaccess?
12:44 am on Dec 23, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:July 12, 2007
posts: 54
votes: 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]

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

Administrator

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

joined:Aug 10, 2004
posts:10888
votes: 72


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...

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

Junior Member

10+ Year Member

joined:July 12, 2007
posts: 54
votes: 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.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members