473,320 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

htaccess is redirecting incorrectly.

Markus
6,050 Expert 4TB
Why is it not working?

I joke. Here's the info:

In the folder C:\host\www\test, I have an .htaccess file. Inside that .htaccess file is the following:
Expand|Select|Wrap|Line Numbers
  1. RewriteEngine On
  2. RewriteRule ^test1.php$ /test2.php [R]
  3.  
If I then go to the url htxp://localhost/test/test1.php, I am redirected to htxp://localhost/test2.php - I thought that this would redirect me to htxp://localhost/test/test2.php? Clearly not. If I removed the forward slash before the 'test2.php', I am redirected to htxp://localhost/C:/host/www/l/test2.php

I am running EasyPHP 3.

Here's the httpd.conf info that I think relates to this problem:
Expand|Select|Wrap|Line Numbers
  1. #
  2. # DocumentRoot: The directory out of which you will serve your
  3. # documents. By default, all requests are taken from this directory, but
  4. # symbolic links and aliases may be used to point to other locations.
  5. #
  6. DocumentRoot "${path}/www"
  7.  
  8. #
  9. # Each directory to which Apache has access can be configured with respect
  10. # to which services and features are allowed and/or disabled in that
  11. # directory (and its subdirectories). 
  12. #
  13. # First, we configure the "default" to be a very restrictive set of 
  14. # features.  
  15. #
  16. <Directory />
  17.     Options FollowSymLinks
  18.     AllowOverride none
  19.     Order allow,deny
  20.     Deny from all
  21. </Directory>
  22.  
  23. #
  24. # Note that from this point forward you must specifically allow
  25. # particular features to be enabled - so if something's not working as
  26. # you might expect, make sure that you have specifically enabled it
  27. # below.
  28. #
  29.  
  30. #
  31. # This should be changed to whatever you set DocumentRoot to.
  32. #
  33. <Directory "${path}/www">
  34.     #
  35.     # Possible values for the Options directive are "None", "All",
  36.     # or any combination of:
  37.     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
  38.     #
  39.     # Note that "MultiViews" must be named *explicitly* --- "Options All"
  40.     # doesn't give it to you.
  41.     #
  42.     # The Options directive is both complicated and important.  Please see
  43.     # http://httpd.apache.org/docs/2.2/mod/core.html#options
  44.     # for more information.
  45.     #
  46.     Options Indexes FollowSymLinks
  47.  
  48.     #
  49.     # AllowOverride controls what directives may be placed in .htaccess files.
  50.     # It can be "All", "None", or any combination of the keywords:
  51.     #   Options FileInfo AuthConfig Limit
  52.     #
  53.     AllowOverride All
  54.  
  55.     #
  56.     # Controls who can get stuff from this server.
  57.     #
  58.     Order allow,deny
  59.     Allow from all
  60.  
  61. </Directory>
Mar 5 '09 #1
2 2647
r035198x
13,262 8TB
And what happens if you put
Expand|Select|Wrap|Line Numbers
  1. RewriteRule ^test1.php$ /test/test2.php [R]
?
Mar 5 '09 #2
Markus
6,050 Expert 4TB
Ah, yes. That works. I just thought that it would redirect to the same directory the htaccess file was in? I guess not.

Thanks, r0.
Mar 5 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: yawnmoth | last post by:
i'm trying to write a php script that will password protect some random directory by creating a .htaccess file, and a password file to accompany the .htaccess file, and it isn't working... ...
4
by: Ivo | last post by:
Greetings newsgroup, I am moving some php scripts to a new host. While getting to know the server, I ran into a strange problem. If I add a .htaccess file, or more specifically: a .htaccess with...
7
by: John | last post by:
Hello. I want to get this blasted .htaccess file sorted out, so I can have sessions without register_globals being on. I have looked everywhere for info on this and I mean everywhere...
3
by: Vardan Kushnir | last post by:
Please forgive me if my English is poor. Also please tell me if this is wrong place to ask this question and tell me better place. When searching web for information Re: .htaccess and...
0
by: Jack Hambabo | last post by:
Hi, I'm searching for a php script that can find out whether the current user (I know _SERVER will give me the name for non-cgi php) has the right to view a specific file. My dream is that I...
8
by: Morpheus | last post by:
I am trying to test a function that outputs text to the standard output, presumably using a cout call. I do not have access to the source, but need to test the output. Is this possible? I can...
1
by: nickyeng | last post by:
I have checked this info from apache website, and i confused with it. Procteing System files it said: To run a really tight ship, you'll want to stop users from setting up .htaccess files...
6
by: Doug Laidlaw | last post by:
Jerry Stuckle wrote: I have never used anything but Apache, but I didn't know that .htaccess was server-specific. How does Windows do it? Doug.
2
by: knkk | last post by:
I want to redirect a url http://abc.xyz.com/123 to http://www.xyz.com. So the file that will be accessed will be index.php of xyz.com. That index.php should have available to it both abc and 123 (so...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.