?
Solved

301 redirect odd URL .htaccess

Posted on 2014-01-07
3
Medium Priority
?
580 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 2000 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

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

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

1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

770 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