php apache .htacess

Discussion in 'PHP' started by tgkprog, Jul 24, 2008.

  1. #1
    hello i have made a apache-php solution to redirect requests to a folder to a particular php

    this php includes the orignally requested page but buffers the output. the output is filtered and edit (links are injected)

    For this I use the htaccess:

    RewriteRule ^(.*.htm) sel2in_wiki_filter_index.php
    RewriteRule ^(.*.php) sel2in_wiki_filter_index.php
    RewriteRule ^(.*.html) sel2in_wiki_filter_index.php
    RewriteRule ^(.*/) sel2in_wiki_filter_index.php
    
    Code (markup):
    client has a wiki installed that uses htaccess

    Options +FollowSymlinks
    RewriteEngine On
    
    AddType text/xml .xslt
    
    <Files *.xslt>
    	SetHandler text/xml
    </Files>
    
    <IfModule !mod_php4.c>
    
    	<IfModule !mod_php5.c>
    
    		# PHP is in CGI Mode, so we need a different mod_rewrite
    
    		RewriteCond %{REQUEST_URI} !categories\.php
    		RewriteRule ^categories(.*) categories.php?$1 [L]
    		
    		RewriteCond %{REQUEST_URI} !articles\.php
    		RewriteRule ^articles(.*)$ articles.php?$1 [L]
    
    		RewriteCond %{REQUEST_URI} !pages\.php
    		RewriteRule ^pages(.*)$ pages.php?$1 [L]
    		
    		RewriteCond %{REQUEST_URI} !blogs\.php
    		RewriteRule ^blogs(.*)$ blogs.php?$1 [L]
    		
    		RewriteCond %{REQUEST_URI} !search.php
    		RewriteRule ^search(.*)$ search\.php?$1 [L]
    		
    		RewriteCond %{REQUEST_URI} !authors.php
    		RewriteRule ^authors(.*)$ authors\.php?$1 [L]
    		
    		RewriteCond %{REQUEST_URI} !articlerss.php
    		RewriteRule ^articlerss(.*)$ articlerss\.php?$1 [L]
    		
    		RewriteCond %{REQUEST_URI} !news.php
    		RewriteCond %{REQUEST_URI} !newsrss.php
    		RewriteRule ^news(.*)$ news.php?$1 [L]
    		
    		RewriteCond %{REQUEST_URI} !contact.php
    		RewriteRule ^contact(.*)$ contact\.php?$1 [L]
    		
    
    	</IfModule>
    
    	<IfModule mod_php5.c>
    		
    		# Using PHP 5 in module mode
    
    		RewriteCond %{REQUEST_URI} categories.*
    		RewriteRule ^categories(.*)$ categories.php?$1 [T=application/x-httpd-php,L]
    
    		RewriteCond %{REQUEST_URI} articles.*
    		RewriteRule ^articles(.*)$ articles.php?$1 [T=application/x-httpd-php,L]
    
    		RewriteCond %{REQUEST_URI} pages.*
    		RewriteRule ^pages(.*)$ pages.php?$1 [T=application/x-httpd-php,L]
    
    		RewriteCond %{REQUEST_URI} blogs.*
    		RewriteRule ^blogs(.*)$ blogs.php?$1 [T=application/x-httpd-php,L]
    
    		RewriteCond %{REQUEST_URI} search.*
    		RewriteRule ^search(.*)$ search.php?$1 [T=application/x-httpd-php,L]
    
    		RewriteCond %{REQUEST_URI} authors.*
    		RewriteRule ^authors(.*)$ authors.php?$1 [T=application/x-httpd-php,L]
    
    		RewriteCond %{REQUEST_URI} articlerss.*
    		RewriteRule ^articlerss(.*)$ articlerss.php?$1 [T=application/x-httpd-php,L]
    
    		RewriteCond %{REQUEST_URI} news.*
    		RewriteCond %{REQUEST_URI} !newsrss
    		RewriteRule ^news(.*)$ news.php?$1 [T=application/x-httpd-php,L]
    		
    		RewriteCond %{REQUEST_URI} contact.*
    		RewriteRule ^contact(.*)$ contact.php?$1 [T=application/x-httpd-php,L]
    
    	</IfModule>
    
    </IfModule>
    
    <IfModule mod_php4.c>
    
    	# PHP 4 in module mode
    
    	RewriteCond %{REQUEST_URI} categories.*
    	RewriteRule ^categories(.*)$ categories.php?$1 [T=application/x-httpd-php,L]
    
    	RewriteCond %{REQUEST_URI} articles.*
    	RewriteRule ^articles(.*)$ articles.php?$1 [T=application/x-httpd-php,L]
    
    	RewriteCond %{REQUEST_URI} pages.*
    	RewriteRule ^pages(.*)$ pages.php?$1 [T=application/x-httpd-php,L]
    
    	RewriteCond %{REQUEST_URI} blogs.*
    	RewriteRule ^blogs(.*)$ blogs.php?$1 [T=application/x-httpd-php,L]
    
    	RewriteCond %{REQUEST_URI} search.*
    	RewriteRule ^search(.*)$ search.php?$1 [T=application/x-httpd-php,L]
    
    	RewriteCond %{REQUEST_URI} authors.*
    	RewriteRule ^authors(.*)$ authors.php?$1 [T=application/x-httpd-php,L]
    
    	RewriteCond %{REQUEST_URI} articlerss.*
    	RewriteRule ^articlerss(.*)$ articlerss.php?$1 [T=application/x-httpd-php,L]
    
    	RewriteCond %{REQUEST_URI} news.*
    	RewriteCond %{REQUEST_URI} !newsrss
    	RewriteRule ^news(.*)$ news.php?$1 [T=application/x-httpd-php,L]
    	
    	RewriteCond %{REQUEST_URI} contact.*
    	RewriteRule ^contact(.*)$ contact.php?$1 [T=application/x-httpd-php,L]
    
    </IfModule>
    Code (markup):
    is there a way to combine there two?

    result should be that the actual pages should be hit for output (like contact.php) and then that output should be sent to another php that can inject a some html and send the new html to the response (URI should remain the same for user)

    thank you
    Regards
     
    tgkprog, Jul 24, 2008 IP
  2. tgkprog

    tgkprog Peon

    Messages:
    28
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    bump - anyone knowa way around this??
     
    tgkprog, Jul 24, 2008 IP