Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite in a content management system

cant conifigure mod_rewrite to work properly in cms

         

hollowpoint

11:14 am on Nov 17, 2009 (gmt 0)

10+ Year Member



Hi,

im having a problem configuring a mod_rewrite for the cms that im woking on. its a database driven cms but has a defined folderpath in the url e.g. http://www.example.com/web/one/two/three

ive been looking at the redirect from the php point of view but as with the nature of mod_rewrite it is hard to understand for the newcomer and im a total newcomer in mod_rewrite i cant use the .htacess solution as there is no specific folders to place them in. I have access to edit the httpd.conf but im going quite crazy with this.

Essentially i want to a site wide rewrite from
http://www.example.com/web/one/two/three to

http://www.example.com/web/three

I dont have access to modify the source code for the cms as its third party software.

Any help would be greatly appreciated

jdMorgan

1:43 pm on Nov 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



HP,

We need to know what your goal is here, as stated from the viewpoint of search results listings or the URL that the user sees in his/her address bar, and compared/contrasted with the actual filepaths inside your server.

Otherwise, it's likely we will guess wrong, and start discussing the right solution to the wrong problem.

From a search results URL or user viewpoint, what are you trying to accomplish?

Jim

hollowpoint

2:17 pm on Nov 17, 2009 (gmt 0)

10+ Year Member



Itll definitely be from a search results url stand point as the folder structure cant be changed at all. The file paths cant be changed as they control the templates that control the look and feel of the site and also any restrictions that have been put in place already.

I would normally create server redirects within the httpd but there is over 300 smaller individual websites runnign on the server and that would take forever and isnt manageable going forward

ive tried using the code below

RewriteRule ^/Test(.*)$ /web/Idea/for/Test$1

but im not getting any joy at all.

hope this helps a bit more

jdMorgan

2:58 pm on Nov 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Example links from your pages and the corresponding search URLs and server filepaths are needed.

This is a three-variable question at present, with nine possible technically-correct solutions, eight of which won't be useful to address your actual needs.

Jim

hollowpoint

3:17 pm on Nov 17, 2009 (gmt 0)

10+ Year Member



www2backup.ul.ie/web/WWW/Services/Trainig is a sample url

ideally i would like to have a google friendly url like
www2backup.ul.ie/web/Training

there are no filepaths per say as the folders themselves are generated by the cms application itself to allow for lots of different websites that need to follow an information hierarchy

its on a backup system at the moment as i cant go taking down the live system unless I can show that this works outright

jdMorgan

3:24 pm on Nov 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In this case, you will change your on-page links to "www2backup.example.com/web/Training", create a mod_rewrite rule to 'map' that URL, when requested by a Web client, to the file "/web/WWW/Services/Trainig", and create another mod_rewrite rule to redirect a request for "/web/WWW/Services/Trainig" *only* if requested as a URL by the client, back to the friendly URL "www2backup.example.com/web/Training".

This may not be what you'd hoped for, but URLs are defined by the links on your pages, while the server defines only filepaths. So the links on your pages must be changed.

In this case, the 'filepaths' are virtual filepaths, implemented 'through' the physical filepath to your CMS, and any query strings or Path_Info that it may require.

Jim

hollowpoint

3:46 pm on Nov 17, 2009 (gmt 0)

10+ Year Member



ah ok i was hoping that i could create a rule that told the server when you see a request for page "x" display the result page "y".

thanks for the input ill give it a go and see how well i get on

g1smd

2:06 am on Nov 18, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



How it works is ...

Redirect: When this URL is requested, tell the browser to make a new request for some other URL instead.

Rewrite: When this URL is requested (by clicking the link on some page), silently get some other file from the internal filesystem.