OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Redirect .doc to .docx

  • Thread starter Thread starter Tolga
  • Start date Start date
T

Tolga

Guest
I have word documents with .doc extension in my hosting files

These files are linked to QR codes. For example, when a QR code is scanned, it goes to this address

https://www.example.com/01-001.doc

QR addresses are physically printed, So I cannot change QR codes. If I change the extensions to .docx it gives a 404 error.

How should I redirect?

I tried this before but it didn't work.

Code:
RewriteEngine On
RewriteCond %{REQUEST_URI} \.doc$
RewriteRule ^(.*)\.doc$ $1.docx [R=301,L]

My .htaccess file, in public_html folder

Code:
RewriteOptions inherit
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
RewriteEngine On
RewriteCond %{REQUEST_URI} \.doc$
RewriteRule ^(.*)\.doc$ $1.docx [R=301,L]

# php -- BEGIN cPanel-generated handler, do not edit
# This domain inherits the “PHP” package.
# php -- END cPanel-generated handler, do not edit
<p>I have word documents with .doc extension in my hosting files</p>
<p>These files are linked to QR codes. For example, when a QR code is scanned, it goes to this address</p>
<p><a href="https://www.example.com/01-001.doc" rel="nofollow noreferrer">https://www.example.com/01-001.doc</a></p>
<p>QR addresses are physically printed, So I cannot change QR codes. If I change the extensions to .docx it gives a 404 error.</p>
<p>How should I redirect?</p>
<p>I tried this before but it didn't work.</p>
<pre><code>RewriteEngine On
RewriteCond %{REQUEST_URI} \.doc$
RewriteRule ^(.*)\.doc$ $1.docx [R=301,L]
</code></pre>
<p>My .htaccess file, in public_html folder</p>
<pre><code>RewriteOptions inherit
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
RewriteEngine On
RewriteCond %{REQUEST_URI} \.doc$
RewriteRule ^(.*)\.doc$ $1.docx [R=301,L]

# php -- BEGIN cPanel-generated handler, do not edit
# This domain inherits the “PHP” package.
# php -- END cPanel-generated handler, do not edit
</code></pre>
Continue reading...
 

Latest posts

B
Replies
0
Views
1
Blundering Ecologist
B
Top