# Apache Rewrite rules (Plone Site) [SOLVED]

## Arkham

Dear Fellows:

I'm close to a nervous breakdown   :Crying or Very sad: 

It's been quite a freaking hell to set the rewrite rules in order to get a plone site working (still not working btw). I've followed almost every how-to and there's this thing that keeps bothering me...

everyone says that the "basic" test for the rewrite rules is

```
RewriteRule ^/(.*) http://my_host:8080/$1
```

that is supposed to redirect everything from my_site to my_site:8080 right? Well, guess what... nothing happens, it just sits in my_site

ReWrite rules ARE working, I've tried with some specific rules.... apache is started with -D PHP -D PROXY -D VIRTUAL_HOST

my main goal is to have redirect my plone site in 

my_host:8080/my_site/      ----->  my_host/my_site/

any updated tutorial or some charitative soul willing to help me?? (it's christmas!!!!)

Thanks

?Last edited by Arkham on Tue Dec 05, 2006 2:57 pm; edited 1 time in total

----------

## sp7xfq

Hi 

here is part of my working config

```
<VirtualHost *:80>

    ServerName          my_serv

    RewriteEngine       On

    RewriteRule          /(.*) http://my_serv:8080/$1 [R]

    ErrorLog               logs/my_serv-error_log

    CustomLog           logs/my_serv-access_log combined

</VirtualHost>

```

Maybe it'll be usefull for you.

br

----------

## Arkham

Thanks for the reply...

but still I don't get anything redirected =(

I've tried that rewrite rule but I still get stuck at the "normal" site, not the rewriten site =(

are you using 2 virtual hosts conf files? or just 1?

Thanks again

?

----------

## sp7xfq

Hi,

I've got over 30 vhost config files  :Smile:  There is clause [R] in my config quoted above, it means [R]edirect, so if the engine works you should be redirected to new address. In your browser's address bar address should be new address visible. 

IMO you may try following checks:

Add in /etc/conf.d/apache2 option `-D INFO` into APACHE2_OPTS, then check presence (and config) of `mod_rewrite.c` at http://your_server/server-info.

Add to your vhost config lines

```
RewriteLog logs/rewrite.log

RewriteLogLevel 9
```

 then examine `rewrite.log` file;

Maybe you've set RewriteCond in wrong way

Dunno what else   :Question:  

----------

## Arkham

Wohooo!!!

Finally got it working.. thanks for the replys man, they really helped me  :Wink: 

My original situation:

I have apache server running on http://myserver/  or http://myserver:80/ (intranet, so not FQDN)

and zope/plone running on http://myserver:8080/mysite/

I wanted to eliminate the numbers from the URL... specifically the plone's port number (8080) 

meaning I can access it by just http://myserver/mysite/  and NOT http://myserver:8080/mysite/, ok?

I edited 00_default_vhost.conf, posting relevant, and context so you can find it   :Wink:  , 

Please note that you ONLY need to change the references to myserver and mysite

```

<IfDefine DEFAULT_VHOST>

<VirtualHost *:80>

    #

    # DocumentRoot: The directory out of which you will serve your

    # documents. By default, all requests are taken from this directory, but

    # symbolic links and aliases may be used to point to other locations.

    #

    ServerName  myserver

    RewriteEngine       on

    RewriteRule /mysite(.*) http://myserver:8080/VirtualHostBase/http/%{SERVER_NAME}:80/mysite/VirtualHostRoot/_vh_mysite/$1 [L,P]

    #ErrorLog    logs/ultraman_error_log

    DocumentRoot "/var/www/localhost/htdocs"

    #

    # This should be changed to whatever you set DocumentRoot to

```

Hope this helps somebody

take care

?

----------

