.htaccess redirect in wordpress

余生长醉 提交于 2020-01-16 02:08:18

问题


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?


回答1:


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



回答2:


.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.



来源:https://stackoverflow.com/questions/16596775/htaccess-redirect-in-wordpress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!