Forum Moderators: phranque

Message Too Old, No Replies

Another Mod_Rewrite Query--

I've had a look around and cant find the answer to this one!

         

nickweb

4:35 pm on Dec 29, 2005 (gmt 0)

10+ Year Member



Hi Folks,

Wondering if someone can help me. I've had a really good look around the web and cant seem to find what I'm looking for.

In short - I run a phpBB forum for a car owners club. I've installed some mods along the way, but it appears as though one of the mods has changed one of the variables that controls the absolute and relative paths.. Everything works, apart from one or 2 small things. I know that if i go looking for the variable, ill change it, and really mess things up, so to save a LOT of hassell, I thin kmod_rewrite should be able to help me.

In line with the basic phpBB structure, everything is accessed thru the main files (index.php, viewtopic.php etc..).

The lastest mod I installed is called a garage mod <snip>. Everything works perfectly in it, apart from the small preview picture for the images of the cars.

If I click the link, the picture loads up fine, but when I right click the preview, and have a look at where its trying to pull the picture from, its trying to access

http://new.example.com/var/www/vhosts/example.com/subdomains/new/httpdocs/*anythingandeverything*

i.e its adding in a whole
var/www/vhosts/example.com/subdomains/new/httpdocs/
which isnt needed and is throwing everything off..

The only problem is that there is a few directories and files that phpBB is looking for, and the best way I can think to get round it is to match anything with an address of:

var/www/vhosts/example.com/subdomains/new/httpdocs/

and replace it with

/

I've tried messing about with the mod_rewrite, but cant seem to get it to do this small and basic thing.. Nothing else has to be passed, it just has to stop the script from accessing

http://new.example.com/var/www/vhosts/example.com/subdomains/new/httpdocs/*anythingandeverything*

and force it to use

http://new.example.com/

Is this possible?

If so, I dont suppose anyone would be kind enough to demonstrate how it would be done? I dont mind doing it myself - just a helpful push in the right direction!

Thanks Again!

Nick

[edited by: jdMorgan at 9:49 pm (utc) on Dec. 29, 2005]
[edit reason] Example.com [/edit]

nickweb

9:29 pm on Dec 29, 2005 (gmt 0)

10+ Year Member



Right - im getting somewhere..

After trying

RewriteRule (.*) http://www.example.com/search?q=$1

i get

http://www.example.com/search?q=www/vhosts/example.com/subdomains/new/httpdocs/garage/upload/garage_gallery-1-1135860332_thumb.jpg

So, its semi working! So I tried

RewriteRule (.*) ../../../../$1
but it dosent seem to want to move up a level or 4...

Anyone any ideas?

Nick

[edited by: jdMorgan at 9:39 pm (utc) on Dec. 29, 2005]
[edit reason] Example.com [/edit]

jdMorgan

9:48 pm on Dec 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The following code might work to remove the extra path info, but it must be considered to be a temporary band-aid solution; You need to review the installation instructions for the new script and find the configuration settings. Apparently, something in there is leaving "DocumentRoot" undefined, and the script is defaulting to the server root.

RewriteRule ^var/www/vhosts/example.com/subdomains/new/httpdocs/(.*)$ /$1 [L]

Even if this apparently 'works', it will still leave your site publishing incorrect and malformed links, which may cause you severe problems in search listings.

Remember that mod_rewrite can change incoming URLs as they are requested from your server, and can either 'steer' the URL to a different server filepath or generate an external redirect to tell the client to re-request the desired content from a new URL; It cannot change the URLs that you 'publish' on your pages. As such, it's not useful as a permanent fix for this problem.

You may also be able to get some assistance on the forum associated with your phpBB or image-preview script, if there is one, or from the authors.

Jim