以下规则有效,但它更改了地址栏中的URL,这不是预期的.
RewriteRule ^network/(.*)$ http://www.example.com/network.php?networkUrl=$1 [L]
以下规则重定向,URL保持不变,但所有图像,包括在network.php文件中被错误地引用...
RewriteRule ^network/(.*)$ network.php?networkUrl=$1 [L]
有没有办法让这项工作?
我怎么能改变这个:
(1) http://test.com/?page=home
进入这个:
(2) http://test.com/home
我想要它,如果你键入(2)服务器发送(1)
好的,所以我在我的opencart应用程序中有这个URL,它运行良好
http://site.com/index.php?route=information/contact
但客户讨厌网址和想要的东西
http://site.com/contact
我想我可以在我的htaccess中做到这一点,一切都会好,但访问网址我什么也得不到
RewriteRule ^(contact)$ index.php?route=information/contact  [L,QSA]
有任何想法吗
这是我的htacess
RewriteBase / 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
RewriteRule ^contact$ /index.php?route=information/contact  [L,QSA]
我正在使用codeigniter并且正在考虑如何创建主页控制器,http:// localhost的控制器.截至目前,我可以访问http:// localhost / {controller}的所有控制器,但不仅仅是localhost.我的.htaccess如下:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|sandbox|scripts|robots\.txt)
RewriteRule ^(.*)$ /index.php/test/$1 [L]
我正在尝试使用javascript获取url参数,因此我可以将参数传递给谷歌地图
问题是我在网址上使用mod重写
www.mysite.com/1/my-event
代替
www.mysite.com/mypage.php?id=1&name=my-event
我已经尝试过做一个警报,但它出现了空白
这是javascript函数,如果我不重写url 将工作
function gup( name ){
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+name+"=([^&#]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec( window.location.href );
    if( results == null )
        return "";
    else
        return results[1];
}
我正在使用CodeIgniter并.htaccess重写URL,但我希望它忽略index.html.
这样我们就可以随时上传index.html,因为这将是一个临时登陆页面.通过链接到主站点上index.php.
这是当前的.htaccess,我已将服务器的目录索引设置为index.html index.php
RewriteEngine on
RewriteCond $1 !^(index\.html|index\.php|js|img|fonts|data|css|uploaded|mobile_devices|audioplayer|emails|robots\.txt|archive_blog)
RewriteRule ^(.*)$ /index.php/$1 [L]
谢谢你的帮助
我正在尝试让我的1and1主机启用mod_rewrite的.htaccess文件,它可以在我的本地wamp上运行,但它不在服务器上,
任何帮助将不胜感激!
我已经尝试删除除了mod_rewrite块之外的所有内容,问题仍然存在......
我已经要求1和1获得支持,他们在没有回答的情况下关闭了我的机票...... o_O,
请帮忙!
.htaccess文件:
#
# Dream Forgery Settings:
#
AddType x-mapp-php5 .php
RewriteEngine on
RewriteBase /
# Rewrite current-style URLs of the form 'strap.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /strap.php?q=$1 [L,QSA]
编辑:
我无法访问apache日志,因为这是一个共享主机,但预期的功能是重定向URL,例如:
http://example.com/arg1/arg2/arg3
至
http://example.com/strap.php?q=arg1/arg2/arg3
(它目前正在提供404错误,只显示1和1中的404页面)
例如:
Dir结构
localhost/
 |- test/
    |- index.php
    |- .htaccess
index.php:
 <?php
        if(isset($_GET['cmd'])){
            echo "cmd is ok";
        }
 ?>
的.htaccess
RewriteEngine On
RewriteRule ^([^/]*)/$ /test/index.php?cmd=$1 [L]
如果用户设置: http://localhost/test/index.php?cmd=a
输出将是: cmd is ok
那没问题!
如果用户设置,我想得到相同的结果http://localhost/test/a
应该如何设置.htaccess/mod_rewrite?
有了代码,我只得到404.
我正在尝试在.htaccess文件中创建重写条件,以检查url是否包含已设置的参数p且参数p = about或p = contact.如果?p = about或?p = contact,则不应该执行下面的RewriteRule.有人可以帮我RewriteCond吗?
RewriteCond %{REQUEST_URI} (?p=about_us|?p=contact)
不起作用.
我有这个应用程序,我想支持多种语言.我认为最简单的方法是使用子域名
http://fr.domain.com/content
现在我在服务器上创建了子域,指向主根,实际上,上面的URL是可访问的.
现在的问题是我的所有链接,这是绝对的.
有没有办法用mod_rewrite从URL中捕获语言,而不是重写到同一子域URL的链接?
因此,如果我们打开http://fr.domain.com/content并单击http://domain.com/link我希望页面加载的链接http://fr.domain.com/link
那可能吗?干杯!
mod-rewrite ×10
.htaccess ×8
php ×3
codeigniter ×2
apache ×1
javascript ×1
parameters ×1
regex ×1
seo ×1
subdomain ×1
url ×1