Solved

301 redirect odd URL .htaccess

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AWS RDS 3 68
Access_log 17 101
CentOS 7 Installation 7 60
su - oracle could not open session 6 53
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
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…
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…
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.:

867 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

23 Experts available now in Live!

Get 1:1 Help Now