ClaytonDaniels
ClaytonDaniels

Reputation: 523

Redirecting a "subfolder" to a new URL; Joomla and .htaccess

This should be simple and I'm not sure why I can't find anything on it...

Simply put

http://www.abcd.org/efg/ (this is a single article in a Joomla site, the rest of the domain needs to stay active, so just the efg part is what I need redirected.)

needs to redirect to

https://www.xyx.com/lmn-op-qrs/

Is this possible in a Joomla site (Joomla Redirect component fails)?

I see plenty for redirecting within a certain domain, and even redirecting the entire domain to a new domain, but nothing about redirecting part of a domain to a new URL.

I'm sure I could pop in a PHP page to the /abcd.org/efg/ directory and redirect it that way, but wondering if it was possible using the .htaccess file.

Thanks!

Upvotes: 1

Views: 553

Answers (2)

user10946716
user10946716

Reputation:

put this rule in top of .htaccess (on http://www.abcd.org/ root directory)

RewriteEngine On
RewriteRule ^efg/$ https://www.xyx.com/lmn-op-qrs/ [R=301,L]

Upvotes: 0

anubhava
anubhava

Reputation: 785376

You may try this rule as your topmost rule:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+efg[?\s/] [NC]
RewriteRule ^ https://www.xyx.com/lmn-op-qrs/ [L,R=301]

Upvotes: 1

Related Questions