小编som*_*nek的帖子

从Apache VirtualHost将HTTPS永久重定向到HTTP

关于将HTTP重定向到HTTPS的问题很多,例如:

<VirtualHost *:80>
    ServerName www.example.com
    Redirect / https://www.example.com/ 
</VirtualHost>

<VirtualHost *:443>
    ServerName www.example.com
    # ... SSL configuration goes here
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

但是我需要从HTTPS到HTTP进行其他操作,可能不使用mod_rewrite。那可能吗?

Apache版本:服务器版本:Apache / 2.4.7(Ubuntu)

我试过了,但是没有用:

<VirtualHost _default_:443>
        ServerName example.com
        ServerAlias *.example.com
        Redirect "/" "http://example.com/"
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

apache https redirect http virtualhost

5
推荐指数
1
解决办法
5133
查看次数

Swift 视频修剪扩展错误 - AVFoundationErrorDomain Code=-11822

我有这个代码(它是一个反应本机模块)

import Foundation
import AVFoundation
import CoreMedia

extension FileManager {
  func removeFileIfNecessary(at url: URL) throws {
    guard fileExists(atPath: url.path) else {
      return
    }

    do {
      try removeItem(at: url)
    }
    catch let error {
      throw TrimError("Couldn't remove existing destination file: \(error)")
    }
  }
}

struct TrimError: Error {
  let description: String
  let underlyingError: Error?

  init(_ description: String, underlyingError: Error? = nil) {
    self.description = "TrimVideo: " + description
    self.underlyingError = underlyingError
  }
}

extension AVMutableComposition {
  convenience init(asset: AVAsset) {
    self.init() …
Run Code Online (Sandbox Code Playgroud)

filesystems file ios swift

5
推荐指数
0
解决办法
846
查看次数

htaccess 检查是否为空查询字符串

我的服务器上有以下情况:

/->
  news-> 
    .htaccess
    index.php
    post.php
...
Run Code Online (Sandbox Code Playgroud)

以及我的 .htaccess 中的以下规则:

RewriteRule    ^(.*)/admin          post.php?slug=$1&admin_mode=true            [NC,QSA,L]
RewriteRule    ^(.*)$               post.php?slug=$1                            [NC,QSA,L]
Run Code Online (Sandbox Code Playgroud)

现在我需要我的网址如下:

如果请求 www.mydomain.com/news/ -> 它应该得到 index.php 文件

如果请求 www.mydomain.com/friendly-title-of-my-article -> 它应该获取 post.php 文件,其中包含我的 .htaccess 中指示的查询字符串。

目前,我使用查询字符串正确获取了 post.php,但是当我访问 www.mydomain.com/news/ 时,它正在请求 post.php 文件。

请帮忙。谢谢

php apache .htaccess mod-rewrite

3
推荐指数
1
解决办法
1861
查看次数

如何在Objective-C代码中重用Swift类型

我正在创建一个自定义的react-native模块,我在swift文件中有这个自定义类型

VideoTrimmer.swift

typealias TrimCompletion = (Error?) -> ()

如何在具有客观代码的文件中导入或重用它?或者重新声明它的语法是什么?我不太熟悉Objective-C语法.

VideoTrimmer.m

#import "React/RCTBridgeModule.h"
@interface RCT_EXTERN_MODULE(VideoTrimmer, NSObject)
  RCT_EXTERN_METHOD(trimVideo:(NSURL *)sourceURL destinationURL:(NSURL 
  *)destinationURL startTime:(int *)startTime endTime:(int *)endTime 
  completion:(TrimCompletion *)completion)
@end
Run Code Online (Sandbox Code Playgroud)

objective-c swift react-native-native-module

3
推荐指数
1
解决办法
2635
查看次数