Solved

301 redirect odd URL .htaccess

Posted on 2014-01-07
3
558 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 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now