Welcome to MobyThreads.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

rewrite doesn't work - help

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Related Topics:
Mod Rewrite - Hello, I have writen this script in on / pers/(.*) [L,R] It is ok, infact if i write: it redirecto to:..

Mod rewrite and OSX - Hi, is loaded in but it does not work, is that something I missed ? Coluche

rewrite url - Hi, I have two domain names on the same (IP-host based). How can I redirect one of the domains to another ? Regards and the best wishes for 2004. Michael

Mod rewrite - Hallo, I have write in a .htaccess File something like this: On !-d !-f [L] I..

mod-rewrite - I am to use to chnage my created pages into static urlls for search engine I am unable to get the rewrite to work, it doesn't seem to do anything. Here is the code on
Next:  Apache: Rewriting rules and reverse proxying  
Author Message
coo2

External


Since: Nov 18, 2003
Posts: 5



(Msg. 1) Posted: Thu Oct 21, 2004 9:15 pm
Post subject: rewrite doesn't work - help
Archived from groups: alt>apache>configuration (more info?)

Hi,
no matter what I try, I cannot get a simple rewrite example to work with
my setup. I do have the rewrite module loaded. So I think it is because I
just cannot seem to get correct the proper placement of the rewrite
commands.

I am not using .htaccess files, so I am putting rewrite commands in
http.conf.

I have a <virtual> block

<VirtualHost *>
ServerName _default_
ServerSignature email
DirectoryIndex index.php index.html index.htm index.shtml
ServerSignature email
LogLevel warn
HostNameLookups off
</VirtualHost>

and further below I have some more specific directory blocks, for example:

<Directory "/">
Options FollowSymLinks
AllowOverride None
Order Deny,Allow
Deny from all
</Directory>

<Directory "/var/www/html">
Options Includes FollowSymLinks
AllowOverride None
Order Deny,Allow
Allow from all
</Directory>

I have been following the various examples for rewrite, and trying a
simple example within the Virtual block, or within the Directory block, as
well as outside of all of these blocks, but nothing seems to work. No
redirection occurs.

For example, I tried this:

RewriteEngine on
RewriteBase /
RewriteRule !(.*)\.htm$ $1.html [R=permanent]

within the <Directory "/var/www/html"> block, but nothing happens (my
Document root is /var/www/html).

Can anyone help? What could be wrong? Where do the Rewrite statements
belong?

Thanks,
Steve, Denmark

 >> Stay informed about: rewrite doesn't work - help 
Back to top
Login to vote
jphblais

External


Since: Oct 21, 2004
Posts: 3



(Msg. 2) Posted: Thu Oct 21, 2004 9:15 pm
Post subject: Re: rewrite doesn't work - help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

cool a écrit :

 > Hi,
 > no matter what I try, I cannot get a simple rewrite example to work with
 > my setup. I do have the rewrite module loaded. So I think it is because I
 > just cannot seem to get correct the proper placement of the rewrite
 > commands.
 >
 > I am not using .htaccess files, so I am putting rewrite commands in
 > http.conf.
 >
 > I have a <virtual> block
 >
 > <VirtualHost *>
 > ServerName _default_
 > ServerSignature email
 > DirectoryIndex index.php index.html index.htm index.shtml
 > ServerSignature email
 > LogLevel warn
 > HostNameLookups off
 > </VirtualHost>
 >
 > and further below I have some more specific directory blocks, for example:
 >
 > <Directory "/">
 > Options FollowSymLinks
 > AllowOverride None
 > Order Deny,Allow
 > Deny from all
 > </Directory>
 >
 > <Directory "/var/www/html">
 > Options Includes FollowSymLinks
 > AllowOverride None
 > Order Deny,Allow
 > Allow from all
 > </Directory>
 >
 > I have been following the various examples for rewrite, and trying a
 > simple example within the Virtual block, or within the Directory block, as
 > well as outside of all of these blocks, but nothing seems to work. No
 > redirection occurs.
 >
 > For example, I tried this:
 >
 > RewriteEngine on
 > RewriteBase /
 > RewriteRule !(.*)\.htm$ $1.html [R=permanent]
 >
 > within the <Directory "/var/www/html"> block, but nothing happens (my
 > Document root is /var/www/html).
 >
 > Can anyone help? What could be wrong? Where do the Rewrite statements
 > belong?
 >
 > Thanks,
 > Steve, Denmark
 >
 >
I usually put it in the VirtualHost container...

JP.<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: rewrite doesn't work - help 
Back to top
Login to vote
hans1

External


Since: Mar 29, 2004
Posts: 672



(Msg. 3) Posted: Fri Oct 22, 2004 12:37 am
Post subject: Re: rewrite doesn't work - help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"cool" <coo DeleteThis @goontrytospamme.dk> schreef in bericht
news:pan.2004.10.21.16.15.56.708848@goontrytospamme.dk...
 > I am not using .htaccess files, so I am putting rewrite commands in
 > http.conf.
 > I have a <virtual> block
 > <VirtualHost *>
 > </VirtualHost>
 > For example, I tried this:
 > RewriteEngine on
 > RewriteBase /
 > RewriteRule !(.*)\.htm$ $1.html [R=permanent]
 >
 > Where do the Rewrite statements belong?
Best inside that <VirtualHost *></VirtualHost>
Outside any <directory ... > you can do without RewriteBase

Further, your rule puzzles me ...
- either the leading ! negates the match, leaving $1 empty
- or you indeed want to append a 'l' AND remove a leading '!'

Finally, WHY do you want the client [browser] to come back with the proper
name, without the R-flag the right page is served too.

HansH<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: rewrite doesn't work - help 
Back to top
Login to vote
coo2

External


Since: Nov 18, 2003
Posts: 5



(Msg. 4) Posted: Fri Oct 22, 2004 12:03 pm
Post subject: Re: rewrite doesn't work - help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

 > Further, your rule puzzles me ...
 > - either the leading ! negates the match, leaving $1 empty - or you
 > indeed want to append a 'l' AND remove a leading '!'
 >
 > Finally, WHY do you want the client [browser] to come back with the
 > proper name, without the R-flag the right page is served too.
 >
 > HansH
Hi,

the rules I showed in my post were just silly examples, I have been trying
for some hours with various rules, mainly to get the addition of a
forgotten trailing slash to work. I can't seem to get any rewriting to
work at all, so therefore I started to make the rules simpler and simpler,
just to see if anything happened.

My question is why wouldn't rewriting work for me, if my module is being
loaded? Thanks for the tips of where to place the rewrite directives (in
the virtual block). Can anyone else say something to why things might not
be working?

Thanks!
Steve, Denmark<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: rewrite doesn't work - help 
Back to top
Login to vote
coo1

External


Since: Nov 13, 2003
Posts: 11



(Msg. 5) Posted: Sat Oct 23, 2004 1:36 pm
Post subject: Re: rewrite doesn't work - help [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Ok, got it working!

apparently I had another item not set correctly in my virtual host
cotainer or elsewhere, which was making my rules not take effect. I turned
on logging at level 9 so I could see what was happening, and this showed
me that the words -default- were being written into the rewritten address
rather than a correct address. So fixing that up, now things work.

Thanks again for the tips on putting the rewrite stuff in the virtual
container.

steve, Denmark
 >> Stay informed about: rewrite doesn't work - help 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]