[Cubicweb] rewriterule and base-url

Florent Cayré florent at secondweb.fr
Sun Mar 7 09:56:00 CET 2010


Hi Carlos,

not sure you have everything in place to get the documented rules working here :

* use a virtualhost to put the rules in, like (do not forget to
activate it with a2ensite my_virtualhost) ::

 <VirtualHost *:80>

    ServerName mydomain.com

    ErrorLog /var/log/apache2/mydomain.log
    LogLevel warn
    CustomLog /var/log/apache2/mydomain.log combined

    RewriteEngine On # this one is important !
    RewriteLog /var/log/apache2/mydomain_rewrite.log
    RewriteLogLevel 3 # remove this as soon as debugged otherwise it
will fill your disk in quickly

    ProxyPreserveHost On # use this to preseve host if you use it in
your cw instance (particularly useful if you have distinct subdomains
handled by a single cw instance) ; anyway it can not hurt

    # YOUR RULES GO HERE (I just copied yours without checking - read
the above configured rewrite log to debug them)
    RewriteCond %(REQUEST_URI) ^/forge
    RewriteRule ^/forge$ /forge/
    RewriteRule ^/forge/(.*) http://127.0.0.1:8080/$1 [L,P]

 </Virtualhost>

* do not forget to activate the rewrite and proxy_http modules (with
a2enmod rewrite ; a2enmod proxy_http) and to configure the proxy
module with something like "Allow from all" (please make sure you know
what you are doing here).

* then restart apache2 with /etc/init.d/apache2 restart

Hope it helps,
Regards,
Florent.


2010/3/6 Carlos Balderas <carlos.balderas at gmail.com>
>
> Hi everyone, I am changing the url of my application (forge) from http://mydomain:8080/ to http://mydomain/forge (for instance).
>
> What I am doing is:
>
> 1.- Enable rewrite module in our apache2 server (tested with Redirect command)
> 2.- Write the .htaccess file in /var/www/ path
> 3.- Put this lines in there
>
> RewriteCond %(REQUEST_URI) ^/forge
>
> RewriteRule ^/forge$ /forge/
> RewriteRule ^/forge/(.*) http://127.0.0.1:8080/$1 [L,P]
>
> based on this link
> http://www.cubicweb.org/doc/en/admin/instance-config.html?highlight=rewritecond
>
>
>
> 4.- change my all-in-one.conf file
> main.base-url = http://mydomain/forge
>
> but I don't get it to work...
>
> Any help will be very appreciated
> Thank you very much
> Carlos Balderas
>
> _______________________________________________
> Cubicweb mailing list
> Cubicweb at lists.cubicweb.org
> http://lists.cubicweb.org/mailman/listinfo/cubicweb
>



--
Ce message est la propriété de SecondWeb et peut contenir des
informations confidentielles. Si vous n'êtes pas le destinataire
désigné, nous vous remercions de bien vouloir nous en aviser
immédiatement et de nous retourner ce message ou de le détruire, sans
faire un quelconque usage de son contenu, ni le communiquer ou le
diffuser, ni en prendre copie, électronique ou non.

This message is the property of SecondWeb and may contain confidential
information. If you are not the designated recipient, please notify us
immediately and return the message to us or destroy it, without making
any use whatsoever of the contents thereof. Furthermore you should not
forward or copy the message by electronic or other means.



More information about the Cubicweb mailing list