473,624 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

htaccess is redirecting incorrectly.

Markus
6,050 Recognized Expert Expert
Why is it not working?

I joke. Here's the info:

In the folder C:\host\www\tes t, 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 2661
r035198x
13,262 MVP
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 Recognized Expert Expert
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
7692
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... specifically, i can't enter the newly created directory with a username of test, and a password of test, which is what i am trying to do. also, i'm testing this script out on a remote server, and... after this script runs, i can't delete any of the...
4
2984
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 content, to a folder, requesting (html and php) files from that folder results in internal server error messages. If I upload an empty .htaccess file, all is fine. Then phpinfo() tells me I am using Apache/1.3.27.
7
7519
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 including the php.net manual. In the manual it said to include something like the following:
3
2127
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 redirecting, I see many different examples of methods. I wish to be able to say "this is good method that I can always use" even if exists other good methods. I wish not be confused by many different examples of methods.
0
1996
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 just need a short php script that just asks the webserver what the rights are. That seems a reasonable wish to me. If this is however not possible than I'd like a script that can
8
5778
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 technically create an executable that calls the function and then using a command prompt call the exexutable using the > output.txt redirector but I would prefer to do everything within the application itself. Is there a way for force an output...
1
4888
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 which can override security features you've configured. Here's one way to do it. In the server configuration file, put
6
1735
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
2218
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 123 will be $_SERVER, and abc will come out of $_SERVER) to enable appropriate processing. http://abc.xyz.com already goes to http://www.xyz.com (though configuration by my service provider), and abc can be extracted out of $_SERVER. However,...
0
8629
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7170
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4183
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.