URL Rewrite not working for *.mp4 file extension - iis

I'm working on a DNN site, and I have a requirement to set up a URL rewrite to redirect incoming requests for a particular URL for an MP4 video to a different location. I can get it working if the incoming URL does not have the *.mp4 file extension, but if the extension is there, the redirect fails and I get a 404.
I set up the rewrite by modifying the SiteUrls.config file to add the following entry:
<RewriterRule>
<LookFor>.*VIDEOFILENAME.mp4(.*)</LookFor>
<SendTo>http://externalsite/video/VIDEOFILENAME.mp4$1</SendTo>
</RewriterRule>
The above configuration results in a 404 if you try to browse to mydnnsite/VIDEOFILENAME.mp4.
However, the following configuration works just fine if you try to browse to mydnnsite/VIDEOFILENAME (without the *.mp4 extension.)
<RewriterRule>
<LookFor>.*VIDEOFILENAME(.*)</LookFor>
<SendTo>http://externalsite/video/VIDEOFILENAME.mp4$1</SendTo>
</RewriterRule>
For whatever reason, the presence of the file extension is preventing the redirect from happening.

IIS is probably setup to route requests with an .mp4 extension to the static file handler, and it isn't getting to DNN to rewrite the request at all. You can look at the Handler Mappings configuration in IIS to see if there's a mapping for *.mp4.
Ideally you'd be doing that redirect in IIS, anyway, rather than sending it to DNN, just to redirect back out.

Related

When trying to access index.php it redirects to index and shows 404 page

Im using IIS and I recently installed a module called URL Rewrite 2.
I tried changing the way index.php shows in the url.
I wanted to change from http://localhost/index.php to http://localhost/index
I did that and it wasn't working so I reverted everything.
Now when I search for http://localhost/index.php it redirects me to http://localhost/index and shows a 404 page.
I don't have any web.config in the server folder. I even unnistalled URL Rewrite 2. Everything was working before I tried this.
If you are sure you have reverted everything the redirect might be cached in the browser, try clearing the cache (or using another browser).

CDN files url need to redirect 301 or 302?

I create CDN server with NodeJs
For cache controlling, I keep last file versions in Server DB.
From client, I request to main file name, without version: "cdn.xxx.com/file.js"
Then in server I find file version and redirect 302 to: "cdn.xxx.com/file.js?v=3.2"
these are my questions:
1) As file versions might change multiple times in week, so i redirect 302, not 301 (permanent). Did I do the right thing?
2) looks like Google-bot has problem with this redirection, most of my links fails with "Redirection error" in Search Console Live Test. Any idea why?
Test link: https://cdn.boqr.at/ADMdtpDrv

robots.txt file works in localhost but fails on server in php

I have been developing a web application in Codeigniter - PHP framework, and am creating a dynamic robots.txt for web crawlers, I use a target file robots.txt.php to be accessed dynamically by web crawlers, and the whole operation is successful on localhost.
This is my code in the .htaccess that I use to redirect the static robots.txt file to access the dynamic contents of robots.txt file :
RewriteRule ^robots\.txt$ robots.txt.php
I Deleted robots.txt file from my localhost, and the robots.txt file works perfectly when I call https://localhost.domain/robots.txt it works but commit my work, and deletion of the file to the server , and i call https://serverdomain/robots.txt
it returns a 404 error, how can I correct it. I would like to know why it works on the localhost and it does not work on the remote server.

URL rewrite disappears on an Virtual Machine in azure

I have a virtual machine in Azure and on that machine I have a IIS installed. On that IIS I have installed the URL Rewrite module and redirect all HTTP calls to HTTPS.
The problem I am noticing is that my rule that I am creating is removed from time to time. Have anybody any clue to why this is happening and how I can do the redirection from HTTP to HTTPS instead in a way not using the URL rewrite module.
Thanks
/Magnus
Aaa I found it!
It seems that the URL rewrite is removed every time I deploy a new version, and the reason is that the URL rewrite information is saved in the web.config file on the server when I add it in the IIS Administration.
And it's not part of my web.config file that I deploy. So all I have to do is to add the XML added by the URL Rewrite module from the web.config file on the server to my web.config file in my project and the redirect will stay.

I don't have .htaccess file for my magento installation. How to get .htaccess file to remove the "index.php" from URL

I don't have my .htaccess file for my magento installation which is by default present for all the fresh magento installation.
Now I have to remove "index.php" from my wesite url and found out htaccess file needs to be edited. But, there is no .htaccess file in my magento root folder.
Also, I have made a lot of changes to the website and don't want to do a fresh installation to get the .htaccess file.
Also, when I access my admin panel it also needs "index.php" in the URL.
Please, can someone help me with this.
To Remove the inde.php from the URL you need to enable Web Server Rewrites.
You can enable Web Server Rewrites suing below steps:
Login in Backend, from Top Navigation click on System >> Configuration >> Web
Select Use Web Server Rewrites to YES in Search Engines Optimization group.
If you need .htaccess file, you can donwload the compatible magento zip file and can use its .htaccess. There is no need to install magento for this.

Resources