PHP - The Mod_rewrite Apache Module As A Basic Requirement
hello dear linux-community
if a server needs to meed some requirements - eg for installation wordpress and if the server needs to run eg see he https://wordpress.or...t/requirements/ PHP 5.2.4 or greater MySQL 5.0 or greater The mod_rewrite Apache module then i need to have a closer look at the apache2handler in the php-ini Apache Version Apache Loaded Modules core mod_so http_core mod_authn_file mod_authn_core mod_authz_host mod_authz_groupfile mod_authz_user mod_authz_core mod_access_compat mod_auth_basic mod_auth_digest mod_socache_shmcb mod_watchdog mod_ratelimit mod_reqtimeout mod_filter mod_deflate mod_mime mod_log_config mod_env mod_mime_magic mod_expires mod_headers mod_usertrack mod_setenvif mod_version mod_session mod_session_cookie mod_ssl prefork mod_unixd mod_status mod_autoindex mod_dir mod_alias mod_php5 all the mentioned are listed in the php-info.file note: here are no mod_rewrite Apache module so what Similar TutorialsThis topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=359558.0 Hi guys, I've just started using xampp for php. My friend sent me the files i've attached below to see if apache is working for me, but i don't understand why they won't work together. Basically the .html file opens a simple login which works fine. When the password is typed in it should direct me to some links, but for some reason it doesn't. It does however look like the apache server is working fine - it could be something with the code i'm really not to sure. When i try to log in these are one set of the errors it gives me: Warning: file_get_contents(listlinks.array) [function.file-get-contents]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/test1/userlinks.php on line 8 Warning: sqlite_open() [function.sqlite-open]: unable to open database: /Applications/XAMPP/xamppfiles/htdocs/Test1/userlinks.sqlite in /Applications/XAMPP/xamppfiles/htdocs/test1/userlinks.php on line 16 Warning: sqlite_query() expects parameter 1 to be resource, string given in /Applications/XAMPP/xamppfiles/htdocs/test1/userlinks.php on line 20 Warning: sqlite_fetch_array() expects parameter 1 to be resource, null given in /Applications/XAMPP/xamppfiles/htdocs/test1/userlinks.php on line 21 Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/test1/userlinks.php: in /Applications/XAMPP/xamppfiles/htdocs/test1/userlinks.php on line 25 Warning: sqlite_close() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/test1/userlinks.php on line 61 I've literally just started learning web scripting so i apologise for over-looking anything simple. The login.php file is also supposed to be .html aswel - i just changed it to upload. Thanks in advance, Josh. I can't seem to find a tutorial on basics of making a module based php system. Like how to fetch and execute the module. I have an application that uses the PHP LDAP library to connect to the Windows Active Directory:
$ds = ldap_connect($ini['ad_server']) or die("Could not connect");
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); I am wondering if anyone knows if this upcoming patch "2020 LDAP channel binding and LDAP signing" coming from Microsoft will break any PHP applications that are using this ldap library. Thanks in advance,
M A joomla module have the following code which displays the date of an article, and to a seperate line the linked title of that article.
Please help me on how to change that code so that the date and the title of the article to be presented in the same line?
<div class="smartlatest-title"> <?php if($params->get('show_date',1)) echo '<div class="smartlatest-date">'.strftime($params->get('date_format','%d-%m-%Y'), strtotime($item->publish_up)).'</div>'; ?> <?php if($params->get('link_title',1)) { ?><a href="<?php echo $item->link; ?>" class="smartlatest-title-link"><?php } ?> <?php echo $item->title; ?> <?php if($params->get('link_title',1)) { ?></a><?php } ?> </div> This is a node voting module I created and it has a slight problem that I cannot figure out. It's supposed to be a simple 'Vote Up' or 'Vote Down' feature. You click 'Vote Up' and one appears in your vote tally. You click 'Vote Down' and your original vote tally is subtracted by one back down to zero. When it goes back to zero, it gets stuck there. It stays on zero no matter if I choose 'Vote Up' or 'Vote Down' again. There's something that's happening when I move my vote tally back down to zero. Maybe something isn't setup correctly with the $current_votes variable. I don't know. I've been at this for hours. Here's the code: <?php function bonnier_vote_perm() { return array('vote on content'); } function bonnier_vote_menu() { $items = array(); $items['vote'] = array( 'title' => 'vote', 'page callback' => 'bonnier_vote_vote', 'access arguments' => array('vote on content'), 'type' => MENU_CALLBACK, ); return $items; } function bonnier_vote_vote() { $nid = $_REQUEST['nid']; $value = $_REQUEST['votes']; $current_votes = db_result(db_query("SELECT votes FROM bonnier_vote WHERE nid = $nid")); if ($current_votes) { $new_votes = $current_votes + $value; db_query("UPDATE bonnier_vote SET votes = $new_votes WHERE nid = $nid"); } else { db_query("INSERT INTO bonnier_vote (nid, votes) VALUES ($nid, $value)"); } drupal_set_message('Your vote has been recorded'); drupal_goto('node/'.$nid); } function bonnier_vote_nodeapi(&$node, $op, $teaser = null, $page = null) { if ($op == 'view' && !$teaser) { $votes = db_result(db_query("SELECT votes FROM bonnier_vote WHERE nid = {$node->nid}")); if (!$votes) { $votes = 0; } $widget = '<div>'; $widget .= l('Vote Up', 'vote', array('query' => array('nid' => $node->nid, 'votes' => 1))); $widget .= ' '; $widget .= l('Vote Down', 'vote', array('query' => array('nid' => $node->nid, 'value' => -1))); $widget .= ' '; $widget .= 'Sco '. $votes; $widget .= '</div>'; $node->content['vote_widget'] = array( '#value' => $widget, '#weight' => -10, ); } } Any bit of advice would be much appreciated. How do I check in PHP if something like the GD library is installed on a server? I am going to be making a thumbnailing system and the user can install the app on their server. If they have the GD library, continue with making thumbnails, else show a default thumbnail. Hello, I have a directory on my site named "spanish", and I would like any webpage in that directory to be translated to spanish automatically. So is there a way to tell mod_rewrite to add the following string (below) to the beginning of the URL ONLY IF the webpage is in the directory "spanish"? String I'm trying to add to beginning of URL http://translate.google.com/translate?hl=en&sl=en&tl=es&u= So say the url was: www.optimumhealthcare.org/spanish/page.html I would want it to change that URL to: http://translate.google.com/translate?hl=en&sl=en&tl=es&u=www.optimumhealthcare.org/spanish/page.html Any help would be greatly appreciated! Thanks Hello,
First time asking technical question in a forum so I beg pardon for errors.
I have a third party blog module installed on opencart. The original coder helped me to fix some bugs, but he is not answering anymore to emails.
I would like to add a simple pagination to the "latest articles" part, because at the moment the website display the exact number declared in "article limit" and does not show pagination if articles shown are less than the total.
the code from "article_by_type.php" line 85 is the following:
/*recent_article*/ if ($setting['article_type']=='recent_article') { $data = array( 'sort' => 'p.date_added', 'order' => 'DESC', 'start' => 0, 'limit' => $article_limit ); $articles = $this->model_news_article->getArticles($data); }another file "article_list.php" at line 88 and 214 already have pagination: $this->data['article_ajax_load'] = $this->getArticle($article_category_id,$page,$limit,$description_limit);can anyone help add pagination to "article_by_type.php" or adapt the existing pagination code to it ? Attached Files article_by_type.php 6.23KB 0 downloads article_list.php 10.2KB 0 downloads This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=309061.0 Hello. I've set up pagination for my results. I do this with a class. I also have pretty urls with mod_rewrite. I'm wondering how to echo the urls for the paginated data. Currently I have this below for the links. this is in my page.class.php file. I call for it with an include. $links .= ' ' . $prefix . '<a href="' . $this->php_self . '?' . $this->append . '&page=' . $i . '">' . $i . '</a>' . $suffix . ' '; This echos out a link like this which is in my tag page. /index.php?menu=tags&tag=action&page=2 My mod_rewrite works and looks like this /tags/action/page/2 Question is.. How do I change the url in my first code to work with my mod_rewrite? I'm using this class through my whole site so I don't want to just add /tags/ to the first code.. Any ideas? Hey guys. I currently have my website set up 'generating' php pages, rather than simply getting data off the database. Which is silly. I have no rectified that issue but end up with ugly urls such as http://www.worldwidelighthouses.com/Lighthouses/English-Lighthouses/Trinity-House-Owned/Lighthouse.php?Lighthouses=Beachy-Head Whats the best way to translate that into http://www.worldwidelighthouses.com/Lighthouses/English-Lighthouses/Trinity-House-Owned/Beachy-Head Im hopeless with apaches mod_rewrite... Many many thanks in advance. Danny I am trying to handle 404 errors to mainly pdf files that used to reside in a different directory but have now moved permanantly to a new directory. I have tired many variations for the rewrite and none have worked or even given me errors to make me think I am kind on the right track.
This is the line I have tried using
RewriteRule ^/files/starter-manuals(.*) /admin_files/PDF$1 [R=301,L]This is an example of a url that should be redirected http://remotelystart...nuals/RS625.pdf Here is a copy of the whole htaccess just in case something else if mking it not work. RewriteEngine On RewriteCond %{HTTP_HOST} ^www.remotelystartedmn.com$ [NC] RewriteRule ^(.*)$ http://remotelystartedmn.com/$1 [R=301,L] RewriteCond %{QUERY_STRING} ^product_id=(.*)$ RewriteRule . %{REQUEST_URI}?product-id=%1 [R=301,L] RewriteBase / RewriteCond %{HTTP:Cookie} devicePixelRatio [NC] RewriteRule \.(?:jpe?g|gif|png|bmp)$ /retinaimages.php [NC,L] RewriteRule ^/files/starter-manuals/(.*) /admin_files/PDF/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-s RewriteRule ^(.*)\.[\d]+\.(css|js)$ $1.$2 [L] ErrorDocument 404 /404.php # ---------------------------------------------------------------------- # Expires headers (for better cache control) # ---------------------------------------------------------------------- # # These are pretty far-future expires headers # They assume you control versioning with cachebusting query params like: # <script src="application.js?20100608"> # Additionally, consider that outdated proxies may miscache # # www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/ # # If you don`t use filenames to version, lower the css and js to something like "access plus 1 week" # <IfModule mod_expires.c> ExpiresActive on # Perhaps better to whitelist expires rules? Perhaps. ExpiresDefault "access plus 1 month" # cache.appcache needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5) ExpiresByType text/cache-manifest "access plus 0 seconds" # Your document html ExpiresByType text/html "access plus 0 seconds" # Data ExpiresByType text/xml "access plus 0 seconds" ExpiresByType application/xml "access plus 0 seconds" ExpiresByType application/json "access plus 0 seconds" # RSS feed ExpiresByType application/rss+xml "access plus 1 hour" # Favicon (cannot be renamed) ExpiresByType image/x-icon "access plus 1 week" # Media: images, video, audio ExpiresByType image/gif "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType image/jpg "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType video/ogg "access plus 1 month" ExpiresByType audio/ogg "access plus 1 month" ExpiresByType video/mp4 "access plus 1 month" ExpiresByType video/webm "access plus 1 month" # HTC files (css3pie) ExpiresByType text/x-component "access plus 1 month" # Webfonts ExpiresByType font/truetype "access plus 1 month" ExpiresByType font/opentype "access plus 1 month" ExpiresByType application/x-font-woff "access plus 1 month" ExpiresByType image/svg+xml "access plus 1 month" ExpiresByType application/vnd.ms-fontobject "access plus 1 month" # CSS and JavaScript ExpiresByType text/css "access plus 1 month" ExpiresByType application/javascript "access plus 1 month" ExpiresByType text/javascript "access plus 1 month" <IfModule mod_headers.c> Header append Cache-Control "public" </IfModule> </IfModule> AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascriptI have also tried putting the line in question above the RewriteBase, putting an absolute url for both directories and removed/moved slashes before/after just about everything but nothing has worked. Any insight is appreciated! This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=308956.0 A few questions about mod_rewrites... 1.) If I want to determine if the URL ends with either "list" or "gallery", and then take appropriate action, does the code below look correct?
RewriteRule shop/(.+)/([list|gallery])$ shop/catalog.php?category=$1&view=2 [L]
2.) Is it bad to use mod_rewrites to determine how your website branches? For example...
RewriteRule shop/music/(.*)$ go somewhere [L] RewriteRule shop/movies/(.*)$ go somewhere else [L] RewriteRule shop/books/(.*)$ go yet somewhere else [L]
This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=357809.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=328109.0 Created module like No other products add to cart if restricted product available in cart and vice versa. My Module : app/etc/modules/Brst_Test.xml<?xml version="1.0"?> <config> <modules> <Brst_Test> <active>true</active> <codePool>community</codePool> </Brst_Test> </modules> </config> This is my observer file app/code/community/Brst/Test/Model/Observer.php<?php ini_set('display_errors', '1'); // Mage::log('Hy observer called', null, 'logfile.log'); class Brst_Test_Model_Observer { //Put any event as per your requirement public function logCartAdd() { $product = Mage::getModel('catalog/product') ->load(Mage::app()->getRequest()->getParam('product', 0)); $cart_qty = (int) Mage::getModel('checkout/cart')->getQuote()->getItemsQty(); if ($product->getId()==31588 && cart_qty > 0) { Mage::throwException("You can not add This special Product, empty cart before add it"); } // $quote = Mage::getSingleton('checkout/session')->getQuote(); // if ($quote->hasProductId(2)) //{ // Mage::getSingleton("core/session")->addError("Cart has Special Product you can not add another"); // return; // } $quote = Mage::getModel('checkout/cart')->getQuote(); foreach ($quote->getAllItems() as $item) { $productId = $item->getProductId(); if($productId==31588){ Mage::throwException("Cart has Special Product you can not add another"); } } } } ?> app/code/community/Brst/Test/etc/config.xml <?xml version="1.0"?> <config> <modules> <Brst_Test> <version>0.1.0</version> </Brst_Test> </modules> <global> <models> <brst_test> <class>Brst_Test_Model</class> </brst_test> </models> </global> <frontend> <events> <controller_action_predispatch_checkout_cart_add> <observers> <brst_test_log_cart_add> <class>brst_test/observer</class> <method>logCartAdd</method> </brst_test_log_cart_add> </observers> </controller_action_predispatch_checkout_cart_add> </events> </frontend> </config>
Not working, how to solve the error? Hi friends,
I have to transform this url domain.com/main/folder1/folder2/folder3 to
domain.com/get.php?var1=folder1&var2=folder2&var3=folder3
How can i do it with htaccess.
Thank u
Edited by exarhis, 08 July 2014 - 04:42 AM. This topic has been $verb->toPastTense() to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=354538.0 |