繁体   English   中英

htaccess 文件中的 URL 重写规则

[英]URL Re-writing rule in htaccess file

我当前的 URL 如下所示。

http://testnewbisptrainings.bispsolutions.com/course-main.php?sid=5

我想要以下格式的 URL

http://testnewbisptrainings.bispsolutions.com/ETL

使用 IBM DataStage 的解决方案

所以,目前在域名课程页面和课程ID之后即将到来,而我只想要域名之后的课程名称。

此外,我们已将域 HTTP 更改为 HTTPS。 请让我知道如何编写规则,以便它只能在 https 上运行。

如果您想将所有请求重定向到 index.php 并始终获得 $url?

.htaccess

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(config|core|static|robots\.txt)

RewriteRule ^(.+)$ index.php/$1 [L]

如果您想始终重定向到 HTTPS,您可以更改 000-default.conf 中的配置

$ sudo nano /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
        . . .

        Redirect permanent "/" "https://your_domain_or_IP/"

        . . .
</VirtualHost>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM