Wont work on 1.3 but it is working on 2.2.4

Discuss practical ways rearrange URLs using mod_rewrite.

Wont work on 1.3 but it is working on 2.2.4

Postby nikolic » Thu Jul 10, 2008 2:18 am

Hello all.
i have a pretty serious problem on live web site. Currently web site is down and alli know is that .htaccess caused this problem.
I work on my local machine and i have Apache/2.2.4 (Win32) installed. All works fine.
So i uploaded over 80 files on web server, and at the end i uploaded .htaccess and then web site stopped working.

Error i got from technical support is:
Code: Select all
RewriteRule: cannot compile regular expression '^ankete-([A-Za-z0-9-_*%]+)-([0-9]*)-([0-9]*)-([A-Za-z0-9-]+)?$'\n


Web server is working on Apache 1.3

There is my .htaccess file:
Code: Select all
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^ankete-([A-Za-z0-9-_*]+)-([0-9]*)-([0-9]*)-([A-Za-z0-9-]+)?$ i2.php?tabid=$2&portalid=$3&pollid=$4 [L]
RewriteRule ^event-([0-9]*)-([0-9]*)-([A-Za-z0-9-]+)-([A-Za-z0-9-]+)?$ i2.php?tabid=$1&portalid=$2&month=$3&year=$4 [L]
RewriteRule ^kalendar-([0-9]*)-([0-9]*)-([A-Za-z0-9-]+)?$ i2.php?event=$3&tabid=$1&portalid=$2 [L]
RewriteRule ^Sitemap-([0-9]*)-([0-9]*)?$ i2.php?a=sitemap&tabid=$1&portalid=$2 [L]
RewriteRule ^page-([0-9]*)-([0-9]*)-([0-9]*)?$ i2.php?pg=$3&tabid=$1&portalid=$2 [L]
RewriteRule ^Galerija-([A-Za-z0-9-_*%]+)-([0-9]*)-([0-9]*)-([0-9]*)?$ i2.php?a=viewPhotoCat&tabid=$2&portalid=$3&catID=$4 [L]
RewriteRule ^([A-Za-z0-9-_*]+)-([A-Za-z0-9-]+)-([A-Za-z0-9-]+)-([A-Za-z0-9-]+)?$ i2.php?a=readMore&tabid=$2&portalid=$3&cid=$4 [L]
RewriteRule ^([0-9]+)-([0-9]+)-([A-Za-z0-9-]+)?$ i2.php?pismo=$3&tabid=$1&portalid=$2 [L]
RewriteRule ^([A-Z]*).*-([0-9]*).*-([0-9]*).*?$ i2.php?tabid=$2&portalid=$3 [L]


Once more to mention that it is working on apache 2.2.4 on wamp i have installed.
It is very urgent for me so i would appreciate any help.
Thanks a lot,
Vladimir
Last edited by nikolic on Thu Jul 10, 2008 11:33 pm, edited 1 time in total.
nikolic
 
Posts: 3
Joined: Thu Jul 10, 2008 2:07 am

Postby nikolic » Thu Jul 10, 2008 3:55 am

i deleted qeustion mark at the end of regular and it works...
Now i am interested why question mark caused a problem :)
Also, is there a better way to do this rewriting so urls be more friendly?

eg. www.domain.com/some_article/
www.domain.com/calendar/
and so on...

Also i noticed that when i am using slashes in my rules i am getting the page but without any css rules on it.

So if i write a rule as:
Code: Select all
RewriteRule ^ankete/([A-Za-z0-9-_*]+)/([0-9]*)-([0-9]*)/([A-Za-z0-9-]+)?$ i2.php?tabid=$2&portalid=$3&pollid=$4 [L]

it wont work... works only with - sign.
nikolic
 
Posts: 3
Joined: Thu Jul 10, 2008 2:07 am

Postby richardk » Sun Jul 13, 2008 11:08 am

i deleted qeustion mark at the end of regular and it works...
Now i am interested why question mark caused a problem

The ungreedy syntax is not supported with older versions of Apache. This is due to the regular expression library.

Also, is there a better way to do this rewriting so urls be more friendly?

eg. www.domain.com/some_article/
www.domain.com/calendar/
and so on...

That depends how much work you want to put in to it. What exactly are you trying to achieve? Are you trying to remove variables from the URL?

Also i noticed that when i am using slashes in my rules i am getting the page but without any css rules on it.

Relative paths to images, JavaScript, CSS and other external/linked files are broken.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby nikolic » Mon Jul 14, 2008 12:41 am

Hello Richard,
Thanks for your reply.
What i want to achieve are links which are more friendly to user.
I will put a lot of efforts to achieve that and i am wiling to learn as much as i can about mod_rewrite.

I have a lot of diferent trailing parameters in my urls.
Eg. i2.php?tabid=1&portalid=2&tabindex=1
i2.php?tabid=1&portalid=2&tabindex=4&a=readMore&cid=34
i2.php?tabid=1&portalid=2&tabindex=3&modid=22&a=viewEdit
i2.php?tabid=1&portalid=2&tabindex=5&year=2008&moth=5&day=12 // this one shows specific day in the mont for calendar module
i2.php?tabid=1&portalid=2&tabindex=7&month=5&day=1&year=2008// this one shows whole month for calendar module
So i have a few urls with same number of paramteres in url, but they do diferent things.
Application is based on 'tabid'(id of menu) and on modid(id of module which is used on specific menu)
Now if i have Content module(which can have n articles(everyone have own id)) i need to have url like www.domain.com/menuname/contentModuleNa ... leName(url looks like-i2.php?tabid=1&portalid=2&a=readMore&cid=12) if i am on very article, or www.domain.com/menuName/contentModuleNa ... tabindex=2 ) if i am on the page where all articles of this module are.
After i did some rewriting my urls looks like- www.domain.com/Menu_Name-1-1-1 or www.domain.com/article_name-1-1-2-32

I hope i explained what i want to achieve here and sorry if i am not clear enough, english is not my mother tongue tho.

Best regards,
Vladimir
nikolic
 
Posts: 3
Joined: Thu Jul 10, 2008 2:07 am

Postby richardk » Tue Jul 15, 2008 10:26 am

So you are trying to change numbers into words. See: How to change a numeric ID into a name/title.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 112 guests

cron