apache

.htaccess and page names.

I have a fairly massive web site for which I need to modify the names of the files shown in the URL. I am using Apache 2 with mod_rewrite enabled. I currently have the following configuration in my .htaccess file: RewriteEngine on RewriteBase / RewriteRule ^CakeList\.php$ TastyThingsList.php [T=application/x-httpd-php] Now, when I a...

Get width of text with given font in Apache FOP

Hi, I need to programatically get a width of some text (word, specifically) in a given font, size and style, which will be generated in Apache FOP (version 0.95) PDF document. The problem is that I need to know, if given word will fit to a column with a known width, and if it won't - resize to a fitable size. So far I have used java.awt...

Case Insensitive URLs with mod_rewrite

I'd like for any url that doesn't hit an existing file, to do a lookup on the other possible cases and see if those files exist, and if so, 302 to them. If that's not possible, then I'm ok with these compromises: Only check the lowercase version Only check the first path portion For example http://example.com/CoOl/PaTH/CaMELcaSE sho...

How can I create and maintain sessions in series of Perl CGI scripts?

Hi All, I am new to CGI-Perl and sessions. I have a problem running the following code. I have four files 1. Session.html or Session.pm 2. name.pl 3. hobbies.pl 4. job.pl The Session.pm is place in /var/www/html folder and the rest of the files are placed in /var/www/cgi-bin/session folder. I have a basic html file(Session.html) whic...

Is it wrong to configure a webserver to map both HTTP and HTTPS traffic to the same document root?

Is there anything wrong with configuring a webserver to map SSL traffic (port 443) to the same document root as normal traffic (port 80)? Using the same document root for both http and https means you need to implement the following: On each page that needs to be secure, there needs to be some application code that redirects the user ...

jquery on localhost

I am using Linuxmint (= ubuntu linux 9.10) I installed LAmp server which have apache,php mysql and now i am trying to write jquery code i made a file and it worked perfectly with this link : file:///var/www/jquery/jquery.html but when i use this link, then it doesnt work anymore : http://localhost/jquery/jquery.html the file jquery.min...

Some theory: VirtualHosts on the guest OS

Let's say there is a host OS (Mac OS X) and a virtual machine running Ubuntu as guest OS. The guest OS has the IP 192.186.56.101 and some virtual hosts, e.g. ubuntu.server So, how to really map a request to the virtual host ubuntu.server on the guest OS? I tried: Configure the host OS in /etc/hosts to map ubuntu.server to 192.186.56....

Zend and .htaccess

My default 'zend' app has this default structure /zend + webroot /application /config /library /public .htaccess index.php and the default .htaccess redirects the various controller/action details via ./public/index.php RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILE...

How would I convert my .htaccess file to NGINX?

How would I convert my below .htaccess (Apache) file so that it could be used by NGINX? Options -Indexes Options +FollowSymLinks # Enable ETag #FileETag MTime Size FileETag none # Set expiration header ExpiresActive on ExpiresDefault A2592000 Header append Cache-Control "public" # Compress some text file types AddOutputFilterByType D...

display image form other sever and path display on browser should be mine server

I want to show some images from other sites but i want my own servers url without storing at my end. in code i write like this <img src="http://image.com/ab.gif"/&gt; but on bowser source display as <img src="http://mysite.com/ab.gif"/&gt; ...

rewriting links in scraped content using mod_rewrite

Hi, I'm looking to create an iframe on my site that contains amazon.com, and I'd like to control it (see what product the user is at). I realize I can't do this because of browser security policy issues, and the only real workaround is to feed the entire page through my server. So I load the page and I change all the href values from som...

Why does the browser hang when I register a cleanup handler in mod_perl?

I'm using $r->pool->cleanup_register(\&cleanup); to run a subroutine after a page has been processed and printed to the client. My hope was that the client would see the complete page, and Apache could continue doing some processing in the background that takes a few seconds. But the client browser hangs until cleanup sub has returned. ...

How can I safely port my wordpress blog to localhost?

Hi, I'm trying to make local development copies for my wordpress blog. I tried first to install wordpress locally (on XAMPP for Windows), install the plugins then import the live data (from a DB backup). The problem is whenever I import the live data I start getting all sorts of errors, even after I change the blog's URL through the dat...

Trailing slashes problem

When I type this "http://example.com/Hello%20There/" , it displays the index page wich is : "http://example.com/Hello%20There/index.html" . Well, what I want to do is when the user types "http://example.com/Hello%20There" (so like the first one except it doesn't have a trailing slash). I tried many things and specially regular express...

How best for a Windows boy to start with *nix web development?

I have been a Windows/M$ boy now for over 15 years and specialisted in web design for 10 years of that using Classic ASP and ASP.net. Trouble is all the latest funky languages that I want to play with (Django using Python, Rails, NitroJS) are *nix based and often run off Macs and all use Apache not a sniff of a IIS port/version. I've pl...

How to use getenv() in php and SetEnv in a .htaccess with a compiled php-cgi on a shared host

Just putting in context to clarify the main question: On my development machine, PHP5.3.1 is installed on Apache as a module, I use SetEnv APPLICATION_ENVIRONMENT development in my application's root .htaccess file. It is then easily retrievable from any php script with getenv('APPLICATION_ENVIRONMENT'). On the production server, on a ...

Apache mod_rewrite with multiple parameters

I've been struggling to get the following rewrite working ^/agatedepot/([0-9.]+)/([0-9a-zA-Z._]+)\?doc-id=([0-9a-zA-Z._\-]+) to /agateDepot.php?date=$1&filename=$2&doc-id=$3 I know that mod_rewrite is working. I know that it is reading the .htaccess file, I'm just not seeing any redirecting happening. Here's what I have in my .ht...

.htaccess redirect request not index.php

I have a setup like this http://www.example.com/reroute/index.php. I would like to send all request not to index.php to index.php. So anything to /reroute/products would go to /reroute/index.php and would display http://www.example.com/reroute to the browser. It seems simple enough but every thing I have tried either tells me file doesn...

Redirecting /media/* to /project/media/* and everything else to /dispatch.php

I have the following rewrite rules: <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / # Route requests to /media/* to /projects/media/* RewriteRule ^media/.* - [NC,L] # Route all URLs to dispatch.php. RewriteRule ^(.*)$ dispatch.php [L] </IfModule> This redirects everything to dispatch.php, unless the URL is exampl...

How to redirect requested uri that don't exists to 404 page with Apache?

I've now used rewrite to achieve part of my goal: rewriteengine on rewritebase / rewriterule ^([a-zA-Z][a-zA-Z0-9]*)$ resume.php?user=$1 How to add the 404 part? ...