Mike Miller
Mike Miller

Reputation: 3129

Bitnami Wordpress httpd-vhosts.conf url rewrite issue

I am having some issues with URL rewrite from sub domain to sub directory of a wordpress site. I didnt set the WP stuff up just inherited the problem. The box is a Bitnami WordPress.

I am attempting to do some redirects with url masking in the vhosts config. The redirects are fine just not getting the URL to mask and ending up with ugly sub dir in the URL.

This is what I have so far in /opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.domain\.com$
    RewriteRule ^(.*)$ http://domain.com/Ugly_sub_dir [P]

    RewriteCond %{HTTP_HOST} ^app\.domain\.com$
    RewriteRule ^(.*)$ http://domain.com/Another_ugly_sub_dir [P]

And in both cases I am redirecting fine but ending up with URL as:

    domain.com/Ugly_sub_dir
    domain.com/Another_ugly_sub_dir

But would like to see the plain old..

    www.domain.com
    app.domain.com

Any help much appreciated

Upvotes: 2

Views: 963

Answers (1)

Mike Miller
Mike Miller

Reputation: 3129

OK I was approaching this in entirely the wrong way. Solved by setting up a proper vhost (not sure why I didnt do this in the first place - wasnt thinking, its been a while) ..

<VirtualHost *:80>
ServerName www.domain.com
ServerAlias www.domain.com
DocumentRoot "/opt/bitnami/apps/wordpress/htdocs/Ugly_sub_dir"
Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>

Upvotes: 1

Related Questions