[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

301 redirect odd URL .htaccess

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
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…
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.
Suggested Courses
Course of the Month18 days, 1 hour left to enroll

829 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