admin管理员组文章数量:1024054
I'm currently using a plugin that generates a PDF for customers but the URL is way too long. For eg - .pdf. Here's the specific code from the plugin relating to this:
$upload = wp_upload_dir();
$upload_dir = $upload['basedir'];
$upload_dir = $upload_dir . '/pdfuploads';
if (! is_dir($upload_dir)) {
mkdir( $upload_dir, 0755 );
$file = fopen($upload_dir.'/index.html',"wb");
echo fwrite($file,"Silence is golden.");
fclose($file);
}
The PDF then generates in:
=> get_home_url().'/wp-content/uploads/pdfuploads/'
$attachments[0] = $upload_dir.'/pdfuploads/'
I want to shorten this URL so it reads something like - .pdf. I tried adding RewriteRule ^wp-content/uploads/pdfuploads/(.*)$ /pdfs/$1 [R=301,NC,L] to htaccess but that didn't move the files over. Is there a quick fix for this via htaccess or functions? Otherwise, if I need to edit the plugin's PHP files myself, what do I need to change in the above code?
I'm currently using a plugin that generates a PDF for customers but the URL is way too long. For eg - .pdf. Here's the specific code from the plugin relating to this:
$upload = wp_upload_dir();
$upload_dir = $upload['basedir'];
$upload_dir = $upload_dir . '/pdfuploads';
if (! is_dir($upload_dir)) {
mkdir( $upload_dir, 0755 );
$file = fopen($upload_dir.'/index.html',"wb");
echo fwrite($file,"Silence is golden.");
fclose($file);
}
The PDF then generates in:
=> get_home_url().'/wp-content/uploads/pdfuploads/'
$attachments[0] = $upload_dir.'/pdfuploads/'
I want to shorten this URL so it reads something like - .pdf. I tried adding RewriteRule ^wp-content/uploads/pdfuploads/(.*)$ /pdfs/$1 [R=301,NC,L] to htaccess but that didn't move the files over. Is there a quick fix for this via htaccess or functions? Otherwise, if I need to edit the plugin's PHP files myself, what do I need to change in the above code?
本文标签: phpMove plugin upload folder from mywebsitecomwpcontentuploadspdfuploads to mywebsitecompdfs
版权声明:本文标题:php - Move plugin upload folder from mywebsite.comwp-contentuploadspdfuploads to mywebsite.compdfs? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745587910a2157709.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论