.htaccess redirect in wordpress

2019-08-04 04:43发布

I would like users that go to the website 'http://kevingstongramado.p.ht/',

to be redirected to 'http://kevingstongramado.p.ht/catalogo/'. Which is in fact a wordpress website.

I´ve tried this:

Redirect 301 /http://kevingstongramado.p.ht/ http://kevingstongramado.p.ht/catalogo/

Putting the .htaccess inside the root directory of the website. Not the root directory of the folder which contains the wordpress.

Doesn´t work.

"catalogo" is the folder which contains the 'index.php' that opens the wordpress website.

Anyone?

2条回答
霸刀☆藐视天下
2楼-- · 2019-08-04 05:23

.htaccess files are calculated by searching and interpreting the configuration for every .htaccess file in every directory in the path under the document root.

You want something along the lines of

RewriteCond ${REQUEST_URI} !^/catalogo/ [NC]
RewriteRule ^(.*)$ /catalogo/$1 [L]

This makes the rule conditional. It will only execute the rule if /catalogo/ is not present in the request uri. And the actual rule says to take everything and put /catalogo/ in front of it... and that it is the last rule to be executed in the file. This file will be reprocessed when it goes to the /catalogo/ directory.

查看更多
成全新的幸福
3楼-- · 2019-08-04 05:47

Use RedirectMatch

If I am not wrong, you should use the relative path.

Create the index file index.htm in your root folder. Then,

RedirectMatch 301 /index.htm /catalogo//$1
查看更多
登录 后发表回答