[wp-hackers] How to make root relative urls work in, , subdomain

Marcus Pope Marcus.Pope at springbox.com
Wed Nov 9 00:12:02 UTC 2011


Just to follow up with anyone who was curious about this problem...

The issue Ryann was having, and that I overlooked, was that the domain name was being included in the check against the REQUEST_URI in the rewriterule match condition.  That prevented the replacement from ever executing on any request.

Anyway, the solution found in the previous response below should look like this instead:

RewriteCond %{REQUEST_URI} !^/testproject/ 

RewriteRule ^(.*) /testproject/$1 [R=301,L]

I was exhausted last week from a bunch of late-night work and not on top of my game (as shown by a few mistakes I made on a couple different threads last Thursday.)  Alas, I had a 4 day vacation this weekend so I'm all rested up.

Thanks,
Marcus.

-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Marcus Pope
Sent: Tuesday, November 01, 2011 12:50 PM
To: wp-hackers at lists.automattic.com
Cc: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] How to make root relative urls work in, , subdomain

Hmm, unfortunately many things could be causing this. Are you using the .htaccess file recommended by wordpress?  You might want to start there and see if that works for you. 
http://codex.wordpress.org/Using_Permalinks#Creating_and_editing_.28.htaccess.29

You can also check out htaccess debuggers online that can parse your rules and show you errors, if any. There are also posts for debugging htaccess on your server but I've never had to use them before so I dont know how easy they are to work with. 

Email me your final htaccess file in a zip or tar and ill try it out on my dev box, i know mine are processing so it should eliminate the environment issue and then i should be able to ensure the correct formatting as even my write up was done hastily. 

Hope that helps!
- marcus

On Oct 31, 2011, at 10:39 PM, "Ryann Micua" <ryannmicua at gmail.com> wrote:

> Hi Marcus,
> 
> The rewrite doesn't seem to be working on my local server. But, if you 
> say that it's the right then I think it's something wrong with my lamp 
> setup I'll look into it. we came up with almost the same rules anyway 
> =) save for taking out the domain name and adding flags.
> 
>> Hey Ryann, unfortunately I got sucked into a 6 hour meeting in the next 10 minutes so I won't be able to write up a response as complete I would like.  But I can fill you in on more details tomorrow if you don't figure out an option from this response.

>> 
>> Basically you are 90% of the way there.  I'm not sure if the email thread removed the newline, but you'll want to put the RewriteRule on its own line underneath the RewriteCond statement.  You can also take outhttp://wp.dev  and just use/testproject/$1.  And additionally you will want to put [R=301,L]  which indicates that the redirect is a permanent move (301) and to stop processing anymore rules L == Last Rule.
>> 
>> Otherwise the rest looks good.  If the above suggestions don't work out let me know and I'll spend a little more time looking at it.  Here's a formatted version for you to view..
>> 
>> RewriteEngine on
>> 
>> #be sure to include the wordpress .htaccess rules here
>> 
>> #and put this at the bottom of your file RewriteCond %{REQUEST_URI} 
>> !^/testproject/ RewriteRule ^wp\.dev/(.*)/testproject/$1 [R=301,L]
>> 
>> #end of file
> 
> 
> --
> *Ryann Micua*
> /Web Developer/
> ----------------------------------------------------------------------
> --
> 
> Website: /www.pogidude.com/
> Skype: /rmicua/
> Mobile: /+639169273059/
> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list