在wordpress中将url从具有特定字符串重定向到另一个url

在wordpress中将url从具有特定字符串重定向到另一个url,wordpress,.htaccess,Wordpress,.htaccess,我必须将我网站中的url重定向到单个url。意思是如果有人去,他应该去我给他的网址。e、 g.() 我遵循了Stackoverflow上一个问题中的一些答案。但这对我不起作用。我试过这样做 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST

我必须将我网站中的url重定向到单个url。意思是如果有人去,他应该去我给他的网址。e、 g.()

我遵循了Stackoverflow上一个问题中的一些答案。但这对我不起作用。我试过这样做

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Rewriterule ^blog/photos/(.*)$ exampe.com//blog/wp-content/uploads/2015/08/common.png$1 [r=301,nc]
RewriteRule . /blog/index.php [L]

</IfModule>

重新启动发动机
重写库/博客/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^blog/photos/(.*)$exampe.com//blog/wp content/uploads/2015/08/common.png$1[r=301,nc]
重写规则/blog/index.php[L]
我做错什么了吗。请提供帮助并提前致谢。

您可以使用:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/

Rewriterule ^photos/.+$ wp-content/uploads/2015/08/common.png [R=301,L,NC]

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

</IfModule>

重新启动发动机
重写库/博客/
重写规则^photos/+$wp content/uploads/2015/08/common.png[R=301,L,NC]
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/blog/index.php[L]
如果.htaccess位于
/blog/
目录中,则
重写规则
将在
/blog/

之后匹配URI模式,您可以使用:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/

Rewriterule ^photos/.+$ wp-content/uploads/2015/08/common.png [R=301,L,NC]

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

</IfModule>

重新启动发动机
重写库/博客/
重写规则^photos/+$wp content/uploads/2015/08/common.png[R=301,L,NC]
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/blog/index.php[L]

如果您的.htaccess位于
/blog/
目录中,则
重写规则将在
/blog/

之后匹配URI模式,这可能会对您有所帮助:重写规则^blog/photos/img5867_2-tm.jpg(.*)$[r=301,nc]不,它不工作。让我知道我正在使用wordpress,它有自己的.htaccess文件。让我补充我的问题。也许它会帮助你:重写规则^blog/photos/IMG_5867_2-tm.jpg(.*)$[r=301,nc]不,它不起作用。让我知道我正在使用wordpress,它有自己的.htaccess文件。让我补充我的问题。