Jump to content

[SOLVED] Implementing mod_rewrite into full CMS


ionik

Recommended Posts

OK!

 

I have developed a full CMS and now I am doing some custom work for someone and they want the pretty URLS...argh

 

now i allready wrote out all the rewrite rules....theres alot....but the problem is now is that images no longer show up and the css style are gone.

 

now everything is parsed through one index.php file how do i make apache understand that the links for images and css are correct.

 

I've searched and the only thing i could find is make the image path direct but that would be impossiable at this point for an entire CMS theres thousands of images i would need to change....dont have time for that.

 

Is it possiable to do this? or is the only way to is link images instead of images/whatever/img.gif to /subdir/images/whatever/img.gif

 

 

Link to comment
Share on other sites

i just tackled a similar idea  replace with your full context

 

the rewriteconditions in the first rewriterule provide pages to not be rewritten admin.php allows me to manage the CMS

the don't rewrite index.php is to prevent an infinite loop issue

 

the below issues handles all php pages that aren't labeled

as examples

 

mysite.com/archives/

mysite.com/gallery

 

use as needed for pretty urls

it only will rewrite php pages

 

Options +FollowSymLinks
Options +Indexes 
RewriteEngine on

RewriteBase /
RewriteCond %{SCRIPT_FILENAME} !=/hsphere/local/home/****/****.org/admin.php [NC]
RewriteCond %{SCRIPT_FILENAME} !=/hsphere/local/home/*****/*****.org/index.php [NC]
RewriteRule ^(.+)\.php$ index.php?Page_Request=$1&request=1 [QSA,L]     

RewriteRule ^about/$ index.php?Page_Request=about/index [NC,L]
RewriteRule ^about$ index.php?Page_Request=about/index [NC,L]
RewriteRule ^archives/$ index.php?Page_Request=archives/index [NC,L]
RewriteRule ^archives$ index.php?Page_Request=archives/index [NC,L]
RewriteRule ^Events/$ index.php?Page_Request=events/index [NC,L]
RewriteRule ^Events$ index.php?Page_Request=events/index [NC,L]
RewriteRule ^gallery/$ index.php?Page_Request=gallery/index [NC,L]
RewriteRule ^gallery$ index.php?Page_Request=gallery/index [NC,L]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.