Solved

301 redirect odd URL .htaccess

Posted on 2014-01-07
3
572 Views
Last Modified: 2014-01-07
Hi,

For some reason, I have this page that is displayed:

http://www.ultratrust.com/foreign-llc/html?PHPSESSID=4d41a235ca88b7122b3f1dc2fdbd208b

But I don't know how that odd URL (even if I take out the URL parameter) like:
http://www.ultratrust.com/foreign-llc/html

is displaying. I looked for something in my htaccess and did a search for "foreign-llc" and found this line:

RewriteRule ^foreign-llc.html$ ./Articlepage_03.php?id=24

I'm wondering how this URL is showing up then.
http://www.ultratrust.com/foreign-llc/html

Also, how can I do a 301 redirect to the proper page? I tried this:
RewriteRule ^foreign-llc/html$ http://www.ultratrust.com/foreign-llc.html [R=301, L]

But it doesn't work.

Thank you,
Victor
0
Comment
Question by:Victor Kimura
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
Henk van Achterberg earned 500 total points
ID: 39762910
RewriteRule ^foreign-llc.html$ ./Articlepage_03.php?id=24

the DOT means ANY in REGEX.

This means that this also works:

http://www.ultratrust.com/foreign-llcAhtml
http://www.ultratrust.com/foreign-llcBhtml
http://www.ultratrust.com/foreign-llcChtml
http://www.ultratrust.com/foreign-llc_html

Check this page for your answer:

http://www.ksl-consulting.co.uk/301-redirect-examples.html

In this example you see the backslash before the dot. The backslash is "escaping" the dot so it only matches the dot and NOT ANY character!

RewriteEngine On
RewriteRule ^contact_us\.html$ http://www.mydomain.co.uk/contact_us.php [R=301]
RewriteRule ^myoldpage\.html$ http://www.mydomain.co.uk/mynewpage.html [R=301,L]
0
 

Author Comment

by:Victor Kimura
ID: 39763151
Hi Henk,

Thanks, that's helpful!

I read that page and it has good info. Just curious (not that it needs to be fixed now) but I'm wondering why the following gives an error from the server:
RewriteRule ^foreign-llc/html$ http://www.ultratrust.com/foreign-llc.html [R=301, L]

It's that forward slash between the "foreign-llc" and "html"
0
 

Author Closing Comment

by:Victor Kimura
ID: 39763191
Thank you, Henk! God bless!
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question