我有点麻烦得到标准的mod_rewrite wordpress在我的导演.htaccess文件生成正常工作。 我使用的服务器默认情况下已经设置了一个虚拟主机,我对这些虚拟主机没有经验。 我已经达到了一个点,我的头痛,撞在墙上,所以任何帮助表示赞赏。 所以假设,我们可以说我的领域是: http://domain.com 我有我的WordPress的 http://domain.com/wordpress 所以对于我漂亮的链接,domain.com/wordpress中的.htaccess文件显示如下: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /wordpress/ RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d </IfModule> 和我的虚拟主机configuration文件位于etc / apache2 / sites-available / domain.com.conf: <VirtualHost *:80> ServerName app01 ServerAlias domain.com www.domain.com DocumentRoot /var/www/vhosts/application/ <Directory /var/www/vhosts/application> Options FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> <Directory […]
我在.htaccess文件中有以下重写规则 RewriteRule ^js_([A-Za-z0-9\.\_\-]{1,50})\.php$ libjs/misc/$1.js 所以js_messages.php url链接到libjs / misc / messages.js文件 它运行良好,但现在我需要从一些.js文件执行php代码。 我怎样才能做到这一点? 谢谢。 PS抱歉我的英语
我正在运行一个ec2 ubuntu实例,我决定今天更新我的PHP到5.5.7,不幸的是它也触发了apache更新,这也导致了我很多错误,最大的一个是我的重写规则不再被打中,我相信它会改变.conf的东西。 我的网站conf(是的,我的前台和后台网站共享相同的.conf,有点懒,但方便。 <VirtualHost *:80> DocumentRoot /var/www/hivetracking-front/checkout/hive-tracking/public/ ServerName hivetracking.com ServerAlias www.hivetracking.com SetEnv _ENV production <Directory /> DirectoryIndex index.phtml RewriteEngine On LogLevel alert rewrite:trace6 Options Indexes FollowSymLinks AllowOverride All </Directory> ErrorLog /var/www/hivetracking-front/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/www/hivetracking-front/access.log combined </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/hivetracking-back/checkout/hive-tracking-api/public ServerName […]
我试图build立一个简单的mod_rewrite地图,将类别名称翻译成id,如下所示:../category/electronics – > category.php?cat = 1 地图放在www文件夹中。 该代码忽略地图,就好像它不存在一样 这是我的重写代码,有什么不对? 编辑:catmap.txt的path,现在它正常工作 <VirtualHost *:80> DocumentRoot "${path}/www" …. RewriteMap cat2id txt:${path}/www/catmap.txt RewriteEngine On RewriteOptions Inherit RewriteLogLevel 3 RewriteRule ^/beta/category/(.*) /beta/category.php?cat={cat2id:$1} </VirtualHost>
我正在使用NGINX作为我的HTTP服务器从WordPress博客迁移到Jekyll博客,我不希望因为某些URL不能正常工作而中断互联网。 我到了一个我真的需要求助的地步。 原来的WordPress博客URL是这样的: example.com/series/ example.com/series/some-stuff/ 我想通过删除文件扩展名(.html)来模仿这个url,如果有人将WordPressurl存储在他的书签中,则回复一个非404网页。 没有任何重写的Jekyll默认URL是这样的: example.com/series/ –> This one is correct by default. example.com/series/some-stuff.html –> Not ok. 正如你可以看到第一个URL,系列部分已经确定,因为它是index.html页面,Jekyll在这种情况下隐藏了de文件名(如预期的那样),但是当你访问同一部分(/系列)中的任何其他页面获取扩展名的完整文件名。 好吧,我开始在重写工作中删除扩展名,并能够响应相同的WordPress的url,并在这里: rewrite ^/series/(.*)\.html*$ /series/$1 permanent; rewrite ^/series/(.*)/$ /series/$1 permanent; example.com/series/redirect到example.com/series/index –> It's working ok but I don't like that now it's showing me the file name (index). 其他人正在按我期望的方式工作,并正在响应旧的WordPress URls。 example.com/some-stuff.htmlredirect到example.com/series/some-stuff –> Correct! example.com/series/some-stuff/redirect到example.com/series/some-stuff –> Correct! […]
遵循Apache网站上的说明,我在httpd.conf文件的末尾添加了以下内容: RewriteEngine on RewriteMap lowercase int:tolower #define the map file RewriteMap vhost txt:/web-data/vhost.map # deal with aliases as above RewriteCond %{REQUEST_URI} !^/icons/ RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$ # this does the file-based remap RewriteCond ${vhost:%1} ^(/.*)$ RewriteRule ^/(.*)$ %1/httpdocs/$1 RewriteCond %{REQUEST_URI} ^/cgi-bin/ RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$ RewriteCond ${vhost:%1} ^(/.*)$ RewriteRule ^/(.*)$ %1/cgi-bin/$1 [H=cgi-script] 当我运行service httpd […]
美好的一天, 我使用Apache作为我的Tornado应用程序在http://localhost:8090上运行的反向代理。 我希望Apache将通过HTTPS到达/ api / v2的所有内容代理到http://localhost:8090 。 Apache也负责authentication,因此我需要将authentication的用户名转发到我的Tornado应用程序。 因此使用mod_rewrite 。 我已经将以下条目添加到Apacheconfiguration中: <Location "/api/v2"> ProxyPass http://localhost:8090 # Next four lines are to set X-Forwarded-User RewriteEngine On RewriteRule .* – [E=RU:%{LA-U:REMOTE_USER}] RequestHeader set X-Forwarded-User %{RU}e SSLRequireSSL AuthType Basic AuthName "My site" AuthBasicProvider external AuthExternal pwauth Require valid-user Order deny,allow Allow from all </Location> 这工作奇迹,除了我在我的Apache日志中看到以下错误: Request exceeded the […]
在浏览我的网站时,甚至没有对它进行任何修改,整个事情突然发生在我身上。 错误日志充满了这个: Invalid command '%{HTTP_USER_AGENT}', perhaps misspelled or defined by a module not included in the server configuration Google会为此find0个结果。 什么可能导致这个? 我正在使用WordPress的Wordfence插件,偶尔修改.htaccess ,但它以前没有做过,并通过文件看我没有看到任何问题。
我在网站上更改了类别url。 老是这样的: www.example-name.com/category-name-exactly-same-keywords / www.example-name.com/category-name- 完全相同的关键字 /子类别名称– 完全相同的关键字 / 新url: www.example-name.com/category-name/ www.example-name.com/category/subcategory-name/ 我从类别url中删除了“ 完全相同的关键字 ”。 在我的.htaccess中我有这样的: # Category 301 redirection RewriteRule ^ -some-category-suffix(。*)$ $ 1 [L,R = 301] 这很好,如果只有一个类别级别,它会重写: www.example-name.com/category-name-exactly-same-keywords / 至: www.example-name.com/category-name/ 但是,如果有多个类别级别,它只会删除最后一个 www.example-name.com/category-name- 完全相同的关键字 /子类别名称– 完全相同的关键字 / 至: www.example-name.com/category-exactly-same-keywords / subcategory-name / ————————————————– —————————————- 如果重新(删除)“ – 完全相同的关键字 ”的所有实例,如果旧url中有多个url到没有url的新url?
我需要一个.htaccessexpression式来使用第二个getvariables或通过名称获取getvariables。 目前我的mod_rewrite改变URL去除index.php文件名,并改变pageName GETvariables,使它看起来像一个文件名。 我现在需要第二个GETvariables,但目前的方式,它甚至不承认第一次重写后获得variables,所以我想mod_rewrite处理第二个variables将是'blogpage = 1'(1将是你正在使用的博客页面),以便它看起来像这样: *********.co.uk/PageName/2 而不是这个 *********.co.uk/PageName?blogpage=2 由于目前没有这个工作,PHP脚本只是认为var不存在,并返回一个NULL值。 这是我目前的mod_rewrite条件: RewriteCond %{REQUEST_fileNAME} !-d RewriteCond %{REQUEST_fileNAME} !-f RewriteRule ^([^/\.]+)/?$ index.php?pageName=$1