Redirecting to correct url

Hello,
iam in a strange situation.

in my site sitebar, for about 20 urls
instead of giving [B]http://domain.com/filename[/B]
i have given http/domain.com/filename

since its in sidebar, now whenever people trying to visit these pages,
they are going to http://domain.com/http/domain.com/filename and returning 404 error

can you please give me code to redirect them correctly?

slw,

Sorry, your question was lost in translation. However, without seeing your .htaccess file, there is no way that anyone here can help (you need to help us, first, to see your problem).

Regards

DK

thanks dklynn for replying.

its a wordpress based site, so current .htaccess is like this


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

slw,

OIC!

Remove the red code, add the blue code:

# BEGIN WordPress
[COLOR="Red"]<IfModule mod_rewrite.c>[/COLOR]
RewriteEngine on

# Redirect bad links in the form http/domain.com/link
RewriteRule ^http/domain\\.com/(.*) $1 [R=301,L]

[COLOR="Red"]RewriteBase /[/COLOR]
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .[SIZE="5"][COLOR="Blue"]?[/COLOR][/SIZE] /index.php [L]
[COLOR="Red"]</IfModule>[/COLOR]

# END WordPress

Explanations:

  1. A webmaster KNOWS whether mod_rewrite is enabled or not so your <IfModule> wrappers are putting a significant load on the server without any justification. If you’re on a shared server, they should ban you for not removing the wrappers (WP does that to protect “script kiddies” who would otherwise take down their own site).

  2. RewriteBase was designed to UNDO a mod_alias Redirect statement. You don’t have any of those so RewriteBase can do more harm than good.

  3. Before WP’s mod_rewrite sees your linked pages, you must alter them. I’ve used a VERY GENERIC (.*) to capture EVERYTHING (or nothing) from your bad link and informed the SE’s to update to remove that http/domain.com bit.

  4. I’ve “corrected” WP’s code so it will go to index.php whether you’ve reset the DirectoryIndex or not (for no file requested, just the domain).

  5. Don’t forget to remove the closing </IfModule>.

Regards,

DK

i have done what you have said but no luck :frowning:

PS: i just sent you PM with an example url, please check it

YGBSM!

From your example above, simply replace “http/domain.com” with “type/gate-preparation/sample-papers/http/way2freshers.com”. If you hide information like that, you should be able to do the simple replacement when you get a suggested solution.

As an aside, those links are AWFUL! I’m sure they’re beyond your control but, seriously, hammer the individual who created those silly links - then be sure that they do not exceed the 256 character limit (including the domain name and protocol) in the sidebar-generated code or you’ll never receive the full URL!

Edit:

Your example “bad” URL contained 262 characters so you’re in a “heap-o-trouble!”

Regards,

DK

the thing is since its in sidebar,
its appended to all urls of site