我有一个.htaccess应该执行以下操作:
这是我的代码:
Redirect 301 /oldpage.php /newpage
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ - [L,R=404]
ErrorDocument 404 /404
我的问题是:重定向没有转到/ newpage而是对/oldpage.php的查询被重定向到/ 404
感谢您的帮助!
答案 0 :(得分:0)
//Custom 404 errors
ErrorDocument 404 /path/to/custom/404.php
//301 Redirect from a specific Old File to new
Redirect 301 /oldpage.php /newpage.php
//301 Redirect from a different URL path
Redirect 301 /posts http://mywebsite.com/blog
//301 Redirect from an old directory to a new directory
RedirectMatch 301 /old-directory/(.*) /new-directory/$1