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

Ryann Micua ryannmicua at gmail.com
Mon Oct 31 08:11:02 UTC 2011

Hi Marcus, thank you for replying. I'm interested in the .htaccess 
rewrite rule. How do I write it? I tried the following:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/testproject/
RewriteRule ^wp\.dev/(.*) http://wp.dev/testproject/$1


I'm fine with just the .htaccess solution

I don't know mod_rewrite very well although I'm getting the hang of 
writing simple regex patterns.

Thanks so much!

On Monday, 31 October, 2011 01:33 PM, 
wp-hackers-request at lists.automattic.com wrote:
> Hey Ryann, I would suggest that you always use /css/base.css. Then on your dev and staging site I would use an .htaccess rewrite rule that checks for the project name at the start of the request_uri. If it's not there rewrite the url with it prepended at the start. Since .htaccess files have access to environment variables you could even make it controlled by code in the wp_config.php file so you wouldn't have to create a new custom .htaccess file for every project.
> Alternatively you could add a custom rewrite rule in wordpress itself. The wordpress rewrite apihttp://codex.wordpress.org/Rewrite_API  is fully capable of handling this scenario as well, though performance would be faster in mod_rewrite (.htaccess). This api is how wordpress maps urls like /year/month/day to the correct file, as you probably already know there is no actual file for such a url. Considering this is the premise for 90% of the urls processed by the core it is still suitable for your situation. And for dev environments the performance loss is probably not noticeable.
> That way when you switch to production everything will work without the specialized rules and you will have zero performance loss along with zero refactoring costs.
> Hope that helps, if you have questions about specifics just ask!

*Ryann Micua*
/Web Developer/

Website: /www.pogidude.com/
Skype: /rmicua/
Mobile: /+639169273059/

More information about the wp-hackers mailing list