htaccess redirect (XP SP3) 1.7.4 [SOLVED]

Problems with the Windows version of XAMPP, questions, comments, and anything related.

htaccess redirect (XP SP3) 1.7.4 [SOLVED]

Postby cranfan » 07. November 2011 15:52

I am trying to test a simple htaccess page redirect on localhost as per the following format but it is not working:

Code: Select all
Redirect /directory/file.htm http://localhost/mydomain/index.htm


Is this not possible on Windows XAMPP 1.74 or am I doing something wrong?
Other aspects of htaccess such as Indexes and Files Match are working okay.

Thanks.
cranfan
 
Posts: 5
Joined: 07. November 2011 15:36
Operating System: Windows XP SP3

Re: htaccess redirect

Postby Sharley » 07. November 2011 21:39

The \xampp\apache\logs\error.log file may hold a clue.

All paths would need to be in a defined DocumentRoot of Apache so the server knows where to look.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: htaccess redirect

Postby cranfan » 08. November 2011 12:07

Sharley,

There no errors in the log relating to this, although there are other errors.

I have also tried:

Code: Select all
RewriteEngine On
RewriteRule ^file\.htm$ http://localhost/mydomain/index.htm [R=301]


The same result nothing happens.

Please could you clarify
All paths would need to be in a defined DocumentRoot of Apache so the server knows where to look
.

Does anyone have experience of this working on a Windows platform?

Thanks for your help.
cranfan
 
Posts: 5
Joined: 07. November 2011 15:36
Operating System: Windows XP SP3

Re: htaccess redirect

Postby Sharley » 08. November 2011 12:18

You could try
Code: Select all
Redirect permanent /directory/file.htm http://localhost/mydomain/index.htm
The / slash in xampp indicates to Apache that the directory is in the htdocs folder (DocumentRoot).
Make sure that you use the correct case as most thing in XAMPP are case sensitive.

Here is a bunch I used on a web site to put the wind up would be form hackers
Code: Select all
Redirect permanent /cgi-bin/formmail.pl http://www.vcu.edu/police/netcrime.html
Redirect permanent /cgi-bin/formmail.cgi http://www.vcu.edu/police/netcrime.html
Redirect permanent /cgi-bin/FormMail.pl http://www.vcu.edu/police/netcrime.html
Redirect permanent /cgi-bin/FormMail.cgi http://www.vcu.edu/police/netcrime.html


I use this on 2 web sites to do a 301 redirect for people who just type http://mysite.com to http://www.mysite.com which at one time helped with Google SEO.
Code: Select all
RewriteEngine on
Rewritecond %{http_host} ^mysite.com [NC]
Rewriterule ^(.*)$ http://www.mysite.com/index.html$1 [R=301,NC]


Here are some links that might help you understand your redirect issue.
This is an on line .htaccess file generator:
http://www.htaccessredirect.net/

Apache docs:
http://httpd.apache.org/docs/current/mo ... nce.html#R

Some help perhaps from these Google search results

This is a support forum for XAMPP and if your XAMPP installation is working as it should then really that's all we can do for you, the rest is up to you to research, read, experiment and learn.

Good luck and best wishes from someone with many years experience working on all aspects of a Windows platform. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: htaccess redirect

Postby cranfan » 08. November 2011 16:26

Thanks Sharley for your help and the code.

I resolved the Redirect method as a result of your comment:
The / slash in xampp indicates to Apache that the directory is in the htdocs folder (DocumentRoot).

I have a folder in htdocs which is the same as my domain name. I overlooked to include this in the file path.

The mod_rewrite method still doesn't work. I will keep trying.

Thanks again.
cranfan
 
Posts: 5
Joined: 07. November 2011 15:36
Operating System: Windows XP SP3

Re: htaccess redirect

Postby Sharley » 09. November 2011 00:15

Thanks for the feedback. 8)

Good luck with your search for a rewrite solution (Google is your friend). :D

Best wishes. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 214 guests