我有这个地址 http://name.com/category/1/news 我在htaccess中使用这个代码强制打开页面没有www。 RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] 当我打开http://www.name.com/category/1/news然后我redirect到 http://name.com/category.php?id=1&slug=news 这是我的完整的htaccess文件。 RewriteEngine on RewriteRule ^news/(.*)$ news.php?id=$1&slug=$2 RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] 谢谢。
在我的网站统计,我盯着得到这样的奇怪的URL: mysite.com/?p=casino-online-spielen mysite.com/category/page/2/?p=casino-online-spielen 我试过重写,但它已经搞乱了我的WordPress重写或只是没有工作。 我在htaccess或apache上不太好。 <IfModule mod_alias.c> RedirectMatch 403 ?p=(casino|pharmacy) </IfModule> 我需要的是一个htaccess规则,如果发现了赌场这个词,会将用户发送到403错误,或者如果在URL中find了?p =,那么这是不应该发生的。 但是我担心它会破坏档案分页。 另一方面,它应该允许?s =variables以及其中的任何内容。
我已将所有资产切换到新服务器; 然而,当有人打开一个旧的电子邮件,则以前的图像path链接被打破。 我正在尝试使用htaccess将请求redirect到旧服务器,但我不能这样做。 我在旧服务器上用htaccess尝试过的 RewriteRule ^/email/images/(.*)$ http://pathtonewserver/images/$1 [L,R=301] RewriteRule ^.*email/images/(.*)$ http://pathtonewserver/images/$1 [L,R=301]
此代码是删除URL中的任何位置的空元素或元素,但它会变成我的干净脏外观的URL,例如从http://www.example.com/US/FL/-show.html到http://www.example.com /search-products.php?productLocation=FL&countrySelect=US&submit=1 RewriteEngine On RewriteCond %{QUERY_STRING} ^(.+?&)?[^=]+=(?:&(.*))?$ RewriteRule ^ %{REQUEST_URI}?%1%2 [R=302,L,NE] 我通过.php的干净的URL设置是: <select name="country" id="country" onchange="document.forms[0].action='<?php echo $submit == 1 ? '/search.php' : '/index.php' ; ?>';document.forms[0].submit();return false;"> 完整的.htaccess: <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} ^example\.com RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L] RewriteCond %{QUERY_STRING} ^(.+?&)?[^=]+=(?:&(.*))?$ RewriteRule ^ %{REQUEST_URI}?%1%2 [R=301,NE,L] RewriteCond %{REQUEST_FILENAME} -f [NC,OR] RewriteCond %{REQUEST_FILENAME} -d […]
我有一个IP 123.123.123.123的VPS和Apache监听端口7010.(我只有自己的端口7000 … 7020)。 我已经注册了域名提供商的域名mydomain1.com ,他们提供了一个“网页转发”: Name TTL Type Priority Content Forwards to *.mydomain1.com 3600 A 0 212.20.xx xx http://123.123.123.123:7010/ 有用! 现在,当我在浏览器URL栏中inputhttp://www.mydomain1.com时,它会自动转到http://123.123.123.123:7010/ 。 问题:浏览器URL栏只显示http://www.mydomain1.com 0.5秒,然后显示http://123.123.123.123:7010/ ,这在用户体验方面并不好。 如何在浏览器的URL栏中保持显示http://www.mydomain1.com ? 我应该用JavaScript history.pushState(…)破解这个吗? 我应该在一些ReverseProxySomething .htaccess做到这一点? 另一种方法?
想要用给定的用户前缀(“u-”)重写一个URL https://example.com/access/check?user=u-abc&pass=123 到一个没有前缀的URL: https://example.com/access/check?user=abc&pass=123 我尝试了几个规则,例如 RewriteBase / RewriteRule ^access/check?user=u-(.*)$ check?user=$1 我被困在“?” 如果重写只适用于稍微相同,但没有“?”,它确实有效: https://example.com/access/checkuser=u-abc&pass=123 RewriteRule ^access/checkuser=u-(.*)$ checkuser=$1 并提供预期的结果(没有用户前缀“u-”) checkuser=abc&pass=123 我试图匹配“?” 使用[?]或\ x3F,并按照mod_rewrite.org上的描述应用QSA标志,但仍不成功。
如何判断用户是否使用http://ttt.com或http://www.ttt.com ,将其redirect到https://www.ttt.com ? httpd.conf中: <VirtualHost *:80> ServerName www.ttt.com ServerAlias ttt.com DocumentRoot /home/www/html/ttt/public <Directory /home/www/html/ttt/public> #Options ExecCGI #AddDefaultCharset utf-8 DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> .htaccess: RewriteEngine On ############################################ ## always send 404 on missing files in these folders #RewriteCond %{REQUEST_URI} !^/(files)/ RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond […]
Hadoop的NameNode在端口50070( http:// localhost:50070 )上有一个Web UI,它始终可以通过浏览器访问。 我想要密码通过基本身份validation通过.htaccess或httpd.conf保护整个目录。 然而,我所有的努力都是无用的。 以下是我尝试使用的示例: <VirtualHost *:50070> DocumentRoot /usr/hdp/2.2.0.0-2041/hadoop-hdfs/webapps/hdfs <Location /explorer.html> AuthUserFile path_to_passwords_file AuthName "Password Protected" AuthType Basic Require user username </Location> </VirtualHost> 要么 <Directory "/usr/hdp/2.2.0.0-2041/hadoop-hdfs/webapps/hdfs"> Options +Indexes AuthType Basic AuthName "Documents" AuthUserFile path_to_passwords_file Require user username AllowOverride None Order allow,deny allow from all </Directory> 我究竟做错了什么? 有没有其他的方法来在该页面上设置密码保护? 谢谢。
我想要做很多类似这种模式的redirect: domain.com/xxx/?lang=en到domain.com/en/xxx/ 例如: domain.com/about/?lang=en到domain.com/en/about/ 这将所有链接*/?lang=enredirect到一个目标。 RewriteCond %{QUERY_STRING} ^lang=en RewriteRule ^ en/about/? [R=301,L]
我已经改变了我的url http://example.com/course.php?id=1001 至 http://example.com/course/1001 但改变了所有的CSS js和图像的url无法正常工作 我已经使用这个代码 RewriteEngine On RewriteRule ^course/([A-Za-z0-9-]+)/?$ coursedetails.php?id=$1 [NC,L]