当前位置:首页 » 操作系统 » linuxrewrite

linuxrewrite

发布时间: 2023-07-21 08:02:52

㈠ 在linux服务器nginx环境下rewrite规则怎么写

具体方法如下:

1、在/usr/local/nginx/conf/nginx.conf文件末尾加入虚拟主机配置,实例如下:

server
{
listen80;
server_namehttp://www.hebaodans.com;
indexindex.htmlindex.htmindex.php;
root/wwwroot/www.hebaodans.com;

location~.*.(php|php5)?$
{
#fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
includefcgi.conf;
}

#
includerewrite.conf;

log_formathebaodanscom‘$remote_addr–$remote_user[$time_local]“$request”‘
‘$status$body_bytes_sent“$http_referer”‘
‘”$http_user_agent”$http_x_forwarded_for’;
access_log/logs/hebaodanscom.loghebaodanscom;
}

2、vi /usr/local/nginx/conf/rewrite.conf 输入以下规则:

location/{


if(!-e$request_filename)
{

#————START—————WORLDPRESS————
rewrite^/index.phplast;

#————END—————WORLDPRESS————
#————————zen-cartstart——————

#FromUltimateSEOURLs
rewrite"^(.*)-p-(.*).html"/index.php?main_page=proct_info&procts_id=$2&%last;
rewrite"^(.*)-c-(.*).html"/index.php?main_page=index&cPath=$2&%last;
rewrite"^(.*)-m-([0-9]+).html"/index.php?main_page=index&manufacturers_id=$2&%last;
rewrite"^(.*)-pi-([0-9]+).html"/index.php?main_page=popup_image&pID=$2&%last;
rewrite"^(.*)-pr-([0-9]+).html"/index.php?main_page=proct_reviews&procts_id=$2&%last;
rewrite"^(.*)-pri-([0-9]+).html"/index.php?main_page=proct_reviews_info&procts_id=$2&%last;

#ForOpenOperationsInfoManager
rewrite"^(.*)-i-([0-9]+).html"/index.php?main_page=info_manager&pages_id=$2&%last;

#Fordreamscape’sNews&ArticlesManager
rewrite"^news/?"/index.php?main_page=news&%last;
rewrite"^news/rss.xml"/index.php?main_page=news_rss&%last;
rewrite"^news/archive/?"/index.php?main_page=news_archive&%last;
rewrite"^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html"/index.php?main_page=news&date=$1-$2-$3&%last;
rewrite"^news/archive/([0-9]{4})-([0-9]{2}).html"/index.php?main_page=news_archive&date=$1-$2&%last;
rewrite"^news/(.*)-a-([0-9]+)-comments.html"/index.php?main_page=news_comments&article_id=$2&%last;
rewrite"^news/(.*)-a-([0-9]+).html"/index.php?main_page=news_article&article_id=$2&%last;

#Allotherpages
#Don’
#RewriteCond%{REQUEST_FILENAME}!-f[NC]
#RewriteCond%{REQUEST_FILENAME}!-d
rewrite"^(.*).html"/index.php?main_page=$1&%last;
#—————————-zen-cartend—————–

}
}

保存后,运行 kill -HUP `cat /usr/local/nginx/nginx.pid` 平滑重启即可生效。

㈡ Linux web怎么设置只允许域名访问

要实现只用域名访问而不用IP访问,要看所使用的web服务器软件,以nginx为例,可以通过如下方法进行设置:

1、用vim打开nginx的配置文件,一般为nginx/conf/nginx.conf
2、在server的设置里面添加如下内容即可:
#禁止IP访问
server{
listen 80 default;
server_name _;
return 500;
}
或者
server {
listen 80 fault;
server_name _;
rewrite ^(.*) http://域名 permanent;
}

㈢ linux apache配置文件怎么没有rewrite

Apache已经编译安装完了,上传程序,发现必须得用rewrite,重新上载模块。找到apache的源码包安装文件:# tar zxvf httpd-2.2.11.tar.gz# cd httpd-2.2.11/moles/mappers# /usr/local/apache2/bin/apxs -i -a -c ./mod_rewrite.c[root@el5 mappers]# /usr/local/apache2/bin/apxs -i -a -c ./mod_rewrite.c终端窗口提示信息:/usr/local/apache2/build/libtool --silent --mode=compile gcc -prefer-pic -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -O2 -pthread -I/usr/local/apache2/include -I/usr/local/apache2/include -I/usr/local/apache22/include -c -o ./mod_rewrite.lo ./mod_rewrite.c && touch ./mod_rewrite.slo/usr/local/apache2/build/libtool --silent --mode=link gcc -o ./mod_rewrite.la -rpath /usr/local/apache2/moles -mole -avoid-version ./mod_rewrite.lo/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apache2/build/libtool' ./mod_rewrite.la /usr/local/apache2/moles/usr/local/apache2/build/libtool --mode=install cp ./mod_rewrite.la /usr/local/apache2/moles/cp ./.libs/mod_rewrite.so /usr/local/apache2/moles/mod_rewrite.socp ./.libs/mod_rewrite.lai /usr/local/apache2/moles/mod_rewrite.lacp ./.libs/mod_rewrite.a /usr/local/apache2/moles/mod_rewrite.achmod 644 /usr/local/apache2/moles/mod_rewrite.aranlib /usr/local/apache2/moles/mod_rewrite.aPATH="$PATH:/sbin" ldconfig -n /usr/local/apach2/moles----------------------------------------------------------------------Libraries have been installed in: /usr/local/apache2/molesIf you ever happen to want to link against installed librariesin a given directory, LIBDIR, you must either use libtool, andspecify the full pathname of the library, or use the `-LLIBDIR'flag ring linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable ring execution - add LIBDIR to the `LD_RUN_PATH' environment variable ring linking - use the `-Wl,--rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf'See any operating system documentation about shared libraries formore information, such as the ld(1) and ld.so(8) manual pages.----------------------------------------------------------------------chmod 755 /usr/local/apache2/moles/mod_rewrite.so[activating mole `rewrite' in /usr/local/apache2/conf/httpd.conf]完成,通过提示信息看到rewrite库文件已被安装到/usr/local/apache2/moles目录下。现在打开httpd.conf文件后就能找到这行了:LoadMole rewrite_mole moles/mod_rewrite.so重启apache!

热点内容
androidgif控件 发布:2025-03-15 22:10:51 浏览:336
我的世界手机版非常好玩的服务器推荐 发布:2025-03-15 22:04:48 浏览:178
怎样解压手机文件 发布:2025-03-15 22:04:47 浏览:525
我的世界手机基岩版怎么做服务器 发布:2025-03-15 22:04:11 浏览:100
邮件发送压缩文件 发布:2025-03-15 22:04:06 浏览:819
数据库中的数据特征 发布:2025-03-15 21:56:20 浏览:29
账号密码可以用什么替换 发布:2025-03-15 21:55:43 浏览:699
主板自带什么配置好 发布:2025-03-15 21:49:57 浏览:699
交换空间linux 发布:2025-03-15 21:49:57 浏览:85
剪映怎么添加安卓手机里面的录音 发布:2025-03-15 21:45:01 浏览:697