redirecting

redirecting

am 23.06.2006 01:25:35 von tomrue

Can someone please advise me on the correct syntax to use in httpd.conf
to redirect traffic from http://tomrue.net/drupal to http://tomrue.net
without forwarding the content of subdirectories (images, etc.) under
that tree?

I'm running Apache 1.3 on FreeBSD 6.1

Many thanks.

Tom

Re: redirecting

am 23.06.2006 08:35:29 von xicheng

tomrue wrote:
> Can someone please advise me on the correct syntax to use in httpd.conf
> to redirect traffic from http://tomrue.net/drupal to http://tomrue.net
> without forwarding the content of subdirectories (images, etc.) under
> that tree?
>
> I'm running Apache 1.3 on FreeBSD 6.1

RewriteRule ^/drupal/([^/]*)$ http://tomrue.net/$1 [R, L]

(untested)
Xicheng

Re: redirecting

am 23.06.2006 13:05:55 von tomrue

Thank you. This points me in the right direction, but doesn't quite
work.

"Syntax error on line 1406 of /usr/local/etc/apache/httpd.conf:
RewriteRule: bad flag delimiters"

Any suggestions?

Tom



Xicheng Jia wrote:
> tomrue wrote:
> > Can someone please advise me on the correct syntax to use in httpd.conf
> > to redirect traffic from http://tomrue.net/drupal to http://tomrue.net
> > without forwarding the content of subdirectories (images, etc.) under
> > that tree?
> >
> > I'm running Apache 1.3 on FreeBSD 6.1
>
> RewriteRule ^/drupal/([^/]*)$ http://tomrue.net/$1 [R, L]
>
> (untested)
> Xicheng

Re: redirecting

am 23.06.2006 15:22:05 von xicheng

tomrue wrote:
> Thank you. This points me in the right direction, but doesn't quite
> work.
>
> "Syntax error on line 1406 of /usr/local/etc/apache/httpd.conf:
> RewriteRule: bad flag delimiters"
>
> Any suggestions?

sorry, you should remove the space in the [R,L] flag..

RewriteRule ^/drupal/([^/]*)$ http://tomrue.net/$1 [R,L]

you may need to check these flags to see if they fit your needs..
Good luck,
Xicheng

> Tom
>
>
>
> Xicheng Jia wrote:
> > tomrue wrote:
> > > Can someone please advise me on the correct syntax to use in httpd.conf
> > > to redirect traffic from http://tomrue.net/drupal to http://tomrue.net
> > > without forwarding the content of subdirectories (images, etc.) under
> > > that tree?
> > >
> > > I'm running Apache 1.3 on FreeBSD 6.1
> >
> > RewriteRule ^/drupal/([^/]*)$ http://tomrue.net/$1 [R, L]
> >
> > (untested)
> > Xicheng

Re: redirecting

am 23.06.2006 22:20:22 von tomrue

Thanks. I'm new to Apache (a month or two); before that used Win2k3
which isn't comparable in this respect to my knowledge.

I inserted the string as you gave it, after being sure that modrewrite
is sent to "on" in httpd.conf, but it seems to have no effect. Apache
doesn't choke on a graceful restart, as it was before, but no change. I
also tried putting the string into .htaccess in the site's root
directory.

What am I missing or doing wrong??

Tom





Xicheng Jia wrote:

> sorry, you should remove the space in the [R,L] flag..
>
> RewriteRule ^/drupal/([^/]*)$ http://tomrue.net/$1 [R,L]
>
> you may need to check these flags to see if they fit your needs..

Re: redirecting

am 25.06.2006 05:21:58 von xicheng

tomrue wrote:
> Thanks. I'm new to Apache (a month or two); before that used Win2k3
> which isn't comparable in this respect to my knowledge.
>
> I inserted the string as you gave it, after being sure that modrewrite
> is sent to "on" in httpd.conf, but it seems to have no effect. Apache
> doesn't choke on a graceful restart, as it was before, but no change. I
> also tried putting the string into .htaccess in the site's root
> directory.
>
> What am I missing or doing wrong??

It worked fine for me if I put the following lines in the "VirtualHost"
directive.

........

RewriteEngine on
RewriteRule ^/dir/([^/]*)$ "http://example.com/$1"
[R,L]

........


BTW. you can also try:

RedirectMatch ^/dir/([^/]*)$ "http://example.com/$1"

Xicheng

Re: redirecting

am 25.06.2006 20:46:32 von tomrue

It feels like it's close to working, but not quite. This is what I get
when I try either of the two lines that you provided

"Forbidden
You don't have permission to access / on this server.
Apache/1.3.34 Server at tomrue.net Port 80"

I tried removing the trailing / from the line, but had the same result.

Is it a permission issue? If so, I don't know where. At the moment,
until it's working, I'm simply using a redirect string from tomrue.net
to tomrue.net/drupal, but I'd rather have it set up correctly.

Again, thanks for the helpful replies.

Tom


Xicheng Jia wrote:
> tomrue wrote:
> > Thanks. I'm new to Apache (a month or two); before that used Win2k3
> > which isn't comparable in this respect to my knowledge.
> >
> > I inserted the string as you gave it, after being sure that modrewrite
> > is sent to "on" in httpd.conf, but it seems to have no effect. Apache
> > doesn't choke on a graceful restart, as it was before, but no change. I
> > also tried putting the string into .htaccess in the site's root
> > directory.
> >
> > What am I missing or doing wrong??
>
> It worked fine for me if I put the following lines in the "VirtualHost"
> directive.
>
> ........
>
> RewriteEngine on
> RewriteRule ^/dir/([^/]*)$ "http://example.com/$1"
> [R,L]
>

> ........
>

>
> BTW. you can also try:
>
> RedirectMatch ^/dir/([^/]*)$ "http://example.com/$1"
>
> Xicheng

Re: redirecting

am 26.06.2006 02:58:15 von xicheng

tomrue wrote:
> It feels like it's close to working, but not quite. This is what I get
> when I try either of the two lines that you provided
>
> "Forbidden
> You don't have permission to access / on this server.
> Apache/1.3.34 Server at tomrue.net Port 80"
>
> I tried removing the trailing / from the line, but had the same result.
>
> Is it a permission issue? If so, I don't know where. At the moment,
> until it's working, I'm simply using a redirect string from tomrue.net
> to tomrue.net/drupal, but I'd rather have it set up correctly.

I am a little confused, are you trying to redirect from tomrue.net to
tomrue.net/drupal or the inverse?? are there any other rewrite rules??
is there "RewriteBase"??

here is a simple way to solve the "Trailing Slash Problem"

RewriteRule ^/drupal$ /drupal/ [R]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/drupal/([^/]*)$ /path/to/home/$1
(untested)

/path/to/home/ is the absolute path which has the files you want to be
redirected and have permission to access..

Or see this webpage, seems there are quite some topics which can fit
your problems.

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

Good luck,
Xicheng

Re: redirecting

am 26.06.2006 04:13:46 von tomrue

Still doesn't work. I'm obviously doing something wrong. I see what
what's meant by the statement that ModRewrite has a steep learning
curve.

What I'm trying to do is to set the server so that when a user calls
"example.com" what they see is the content of "example.com/drupal", but
without the "drupal" part showing up in the address bar, and without me
needing to physiclly reorganize any of the content. Am I on the right
track, or should I hang it up and stick with a simple redirect?

Thanks for your helpful replies.

Tom



Xicheng Jia wrote:
> tomrue wrote:
> > It feels like it's close to working, but not quite. This is what I get
> > when I try either of the two lines that you provided
> >
> > "Forbidden
> > You don't have permission to access / on this server.
> > Apache/1.3.34 Server at tomrue.net Port 80"
> >
> > I tried removing the trailing / from the line, but had the same result.
> >
> > Is it a permission issue? If so, I don't know where. At the moment,
> > until it's working, I'm simply using a redirect string from tomrue.net
> > to tomrue.net/drupal, but I'd rather have it set up correctly.
>
> I am a little confused, are you trying to redirect from tomrue.net to
> tomrue.net/drupal or the inverse?? are there any other rewrite rules??
> is there "RewriteBase"??
>
> here is a simple way to solve the "Trailing Slash Problem"
>
> RewriteRule ^/drupal$ /drupal/ [R]
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule ^/drupal/([^/]*)$ /path/to/home/$1
> (untested)
>
> /path/to/home/ is the absolute path which has the files you want to be
> redirected and have permission to access..
>
> Or see this webpage, seems there are quite some topics which can fit
> your problems.
>
> http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
>
> Good luck,
> Xicheng

Re: redirecting

am 26.06.2006 06:16:15 von xicheng

tomrue wrote:
> Still doesn't work. I'm obviously doing something wrong. I see what
> what's meant by the statement that ModRewrite has a steep learning
> curve.
>
> What I'm trying to do is to set the server so that when a user calls
> "example.com" what they see is the content of "example.com/drupal", but
> without the "drupal" part showing up in the address bar, and without me
> needing to physiclly reorganize any of the content. Am I on the right
> track, or should I hang it up and stick with a simple redirect?
>
> Thanks for your helpful replies.

oh, that is a completely different questions as I thought:-), so why
not just reset your DocumentRoot in your VirtualHost directive.

DocumentRoot /path/to/drupal/

I guess this is all what you need. :-)

Xicheng

Re: redirecting

am 28.06.2006 02:17:12 von tomrue

Thanks very much. That's what I did earlier this evening. My concern
was (and still is) that doing this will result in some broken images
and paths, particularly to the /graphics directory, as well as some
other branches in the tree under /. I tried making a symbolic link (ln
-s) in the drupal directory to the paths in question, but for some
reason that didn't all the test graphic that I attempted to show up.

Maybe there's something else I can do in httpd.conf, like inserting an
alias? I'll experiment with it. Thanks again for your replies.

Tom


Xicheng Jia wrote:
> tomrue wrote:
> > Still doesn't work. I'm obviously doing something wrong. I see what
> > what's meant by the statement that ModRewrite has a steep learning
> > curve.
> >
> > What I'm trying to do is to set the server so that when a user calls
> > "example.com" what they see is the content of "example.com/drupal", but
> > without the "drupal" part showing up in the address bar, and without me
> > needing to physiclly reorganize any of the content. Am I on the right
> > track, or should I hang it up and stick with a simple redirect?
> >
> > Thanks for your helpful replies.
>
> oh, that is a completely different questions as I thought:-), so why
> not just reset your DocumentRoot in your VirtualHost directive.
>
> DocumentRoot /path/to/drupal/
>
> I guess this is all what you need. :-)
>
> Xicheng

Re: Redirecting

am 13.11.2007 20:23:49 von mtek

Hi Everyone,

I posted earlier and tried the persons suggestion, and it did not
work.

Basically I want to redirect a specific HTML page to a PHP page. I
have this entry in my .htaccess file:

RewriteEngine on
RewriteRule party\.html page1.php [P]

I do not want the address bar to change to the new URL either......

Can anyone help? I appreciate it......

Thanks!

Re: Redirecting

am 14.11.2007 00:17:28 von shimmyshack

On Nov 13, 7:23 pm, m...@mtekusa.com wrote:
> Hi Everyone,
>
> I posted earlier and tried the persons suggestion, and it did not
> work.
>
> Basically I want to redirect a specific HTML page to a PHP page. I
> have this entry in my .htaccess file:
>
> RewriteEngine on
> RewriteRule party\.html page1.php [P]
>
> I do not want the address bar to change to the new URL either......
>
> Can anyone help? I appreciate it......
>
> Thanks!

so you need to serve page1.php when someone goes to party.html, ok

RewriteEngine on
RewriteRule party\.html$ page1.php [L]

are you sure you have the right to use rewrites in your .htaccess
file?

Re: Redirecting

am 14.11.2007 03:20:01 von Mr Apache

RewriteEngine On
RewriteBase /
RewriteRule ^party\.html$ /page1\.php [NC,L]



from http://www.htaccesselite.com/htaccess/

On Nov 13, 2:23 pm, m...@mtekusa.com wrote:
> Hi Everyone,
>
> I posted earlier and tried the persons suggestion, and it did not
> work.
>
> Basically I want to redirect a specific HTML page to a PHP page. I
> have this entry in my .htaccess file:
>
> RewriteEngine on
> RewriteRule party\.html page1.php [P]
>
> I do not want the address bar to change to the new URL either......
>
> Can anyone help? I appreciate it......
>
> Thanks!

Re: Redirecting

am 14.11.2007 18:39:42 von mtek

On Nov 13, 8:20 pm, Apache Admin wrote:
> RewriteEngine On
> RewriteBase /
> RewriteRule ^party\.html$ /page1\.php [NC,L]
>
> fromhttp://www.htaccesselite.com/htaccess/
>
> On Nov 13, 2:23 pm, m...@mtekusa.com wrote:
>
> > Hi Everyone,
>
> > I posted earlier and tried the persons suggestion, and it did not
> > work.
>
> > Basically I want to redirect a specific HTML page to a PHP page. I
> > have this entry in my .htaccess file:
>
> > RewriteEngine on
> > RewriteRule party\.html page1.php [P]
>
> > I do not want the address bar to change to the new URL either......
>
> > Can anyone help? I appreciate it......
>
> > Thanks!

Do I need anything on my httpd.conf? Those entries above do not seem
to be working.........

Re: Redirecting

am 15.11.2007 00:43:57 von shimmyshack

On Nov 14, 5:39 pm, m...@mtekusa.com wrote:
> On Nov 13, 8:20 pm, Apache Admin wrote:
>
>
>
> > RewriteEngine On
> > RewriteBase /
> > RewriteRule ^party\.html$ /page1\.php [NC,L]
>
> > fromhttp://www.htaccesselite.com/htaccess/
>
> > On Nov 13, 2:23 pm, m...@mtekusa.com wrote:
>
> > > Hi Everyone,
>
> > > I posted earlier and tried the persons suggestion, and it did not
> > > work.
>
> > > Basically I want to redirect a specific HTML page to a PHP page. I
> > > have this entry in my .htaccess file:
>
> > > RewriteEngine on
> > > RewriteRule party\.html page1.php [P]
>
> > > I do not want the address bar to change to the new URL either......
>
> > > Can anyone help? I appreciate it......
>
> > > Thanks!
>
> Do I need anything on my httpd.conf? Those entries above do not seem
> to be working.........

make sure allowoveride is not set to none, which restricts the user
of .htaccess files.
is this a host you control, or some company's set up?

Re: Redirecting

am 17.11.2007 16:36:25 von Floor

mtek@mtekusa.com:

> Basically I want to redirect a specific HTML page to a PHP page. I
> have this entry in my .htaccess file:

Another approach:

In section just ad:

alias /mypage.html /usr/www/mysite/mypage.php

Floor