jimfog Posted January 30, 2012 Share Posted January 30, 2012 Ι want to make this link into http://www.hellenicastrology.gr/index.php?option=com_content&view=article&id=53%3A2011-08-23-12-52-24&catid=35%3A2011-07-25-14-15-06&Itemid=56〈=el into search user firendly, as such, i decided to use mod_rewrite. More specifically i wan to turn the above link into http://www.hellenicastrology.gr/prologizontas-ton-eafto-mou. Can this be done with the mod_rewrite module? I amreading the documentation here http://httpd.apache.org/docs/2.2/rewrite/intro.html#regex and from what i understand this cannot be accomplished with mod_rewrite-i am not sure though. WIth mod_rewrite, it seems that, the rewriting into new urls(the "substitution" part), has to do that resources that actually exist in the server. http://www.hellenicastrology.gr/prologizontas-ton-eafto-mou. does not exist somewhere in the server. What can i do-if there is something that can be done? Thanks. Link to comment Share on other sites More sharing options...
boen_robot Posted January 30, 2012 Share Posted January 30, 2012 Your source URL (the one the user enters into their browser) doesn't have to exist. Only the destination URL (the one which Apache ends up calling).Since you want to rewrite http://www.hellenicastrology.gr/prologizontas-ton-eafto-mou (source)into http://www.hellenicastrology.gr/index.php?option=com_content&view=article&id=53%3A2011-08-23-12-52-24&catid=35%3A2011-07-25-14-15-06&Itemid=56&lang=el (destination)Then there's no problem.However, as far as I can see, "prologizontas-ton-eafto-mou" is never featured in the destination URL... so a simple regex substitution may not really be appropriate, although it's technically possible. Consider using a txt RewriteMap for that. In such maps, you simply specify source and destination URLs without a regex to link them. Link to comment Share on other sites More sharing options...
jimfog Posted January 30, 2012 Author Share Posted January 30, 2012 Boen_Robot, Thanks a lot, i am searching for days to fins a solution. I will look at what your solution and see what the outcome will be. Anyway, at least you we have a starting point-very important. Something else, when the redirection occurs in http://www.hellenicastrology.gr/index.php?option=com_content&view=article&id=53%3A2011-08-23-12-52-24&catid=35%3A2011-07-25-14-15-06&Itemid=56〈=el what will be displayed in the address bar of the browser of the user, the above link or http://www.hellenicastrology.gr/prologizontas-ton-eafto-mou.? This is important, i want to be displayed http://www.hellenicastrology.gr/prologizontas-ton-eafto-mou.. Link to comment Share on other sites More sharing options...
jimfog Posted January 31, 2012 Author Share Posted January 31, 2012 I am looking the documentation here:http://httpd.apache.org/docs/2.2/rewrite/rewritemap.html From what i understand i must place http://www.hellenicastrology.gr/prologizontas-ton-eafto-mou. in a text file so that the rewritemap directive to work. Is that correct? Link to comment Share on other sites More sharing options...
boen_robot Posted February 1, 2012 Share Posted February 1, 2012 Something else, when the redirection occurs in http://www.hellenica...emid=56&lang=el what will be displayed in the address bar of the browser of the user, the above link or http://www.hellenica...-ton-eafto-mou.? This is important, i want to be displayed http://www.hellenica...-ton-eafto-mou..If the user types inhttp://www.hellenicastrology.gr/index.php?option=com_content&view=article&id=53%3A2011-08-23-12-52-24&catid=35%3A2011-07-25-14-15-06&Itemid=56&lang=el They'll go straight there, without a redirection or anything. However, if they type (or click a link that points to): http://www.hellenicastrology.gr/prologizontas-ton-eafto-mou their browser will still display http://www.hellenicastrology.gr/prologizontas-ton-eafto-mou while they'll instead be looking at the same page they would've been looking at if they had typed http://www.hellenicastrology.gr/index.php?option=com_content&view=article&id=53%3A2011-08-23-12-52-24&catid=35%3A2011-07-25-14-15-06&Itemid=56&lang=e From what i understand i must place http://www.hellenica...-ton-eafto-mou. in a text fileso that the rewritemap directive to work. Is that correct?Yes. Your txt file must basically look like:prologizontas-ton-eafto-mou index.php?option=com_content&view=article&id=53%3A2011-08-23-12-52-24&catid=35%3A2011-07-25-14-15-06&Itemid=56&lang=el Link to comment Share on other sites More sharing options...
jimfog Posted February 1, 2012 Author Share Posted February 1, 2012 Ok, i will make my tests and get back to report. Link to comment Share on other sites More sharing options...
jimfog Posted February 2, 2012 Author Share Posted February 2, 2012 I tried to implement what is said above and i got the usual "Internal Server Error". So i go step by step in trying to solve this: Look at the this syntax: RewriteMap prologizontas txt:/public_html/prologizontas.txt I do not see sth wrong in it-nonetheless, i still the error page, not when clicking the corresponding link, the whole site does not load at all. Do you see any error in the above code. Since even the above produces error, i want first to debug the above code before proceeding to the rewrite rule syntax. Link to comment Share on other sites More sharing options...
boen_robot Posted February 3, 2012 Share Posted February 3, 2012 Unless your "public_html" folder is at the server root, this probably means the path to the map is wrong, hence the 500 error.Try to place the .htaccess file in your public_html folder, and in it, have it like RewriteMap prologizontas txt:prologizontas.txt Link to comment Share on other sites More sharing options...
jimfog Posted February 6, 2012 Author Share Posted February 6, 2012 Ok i did what you suggested but i still get the error page. prologizontas.txt AND .htaccess are located both in public_html. It seems that public_html IS the root of the server. I placed in .htaccess this-as you said: RewriteMap prologizontas txt:prologizontas.txt and as i state above the problem continues. Any ideas? thanks. Link to comment Share on other sites More sharing options...
boen_robot Posted February 11, 2012 Share Posted February 11, 2012 Do you have access to the error logs from some place? It's very difficult to debug mod_rewrite stuff in the dark.Oh, and, I assume you have RewriteEngine On earlier in the .htaccess file, right? Link to comment Share on other sites More sharing options...
jimfog Posted February 16, 2012 Author Share Posted February 16, 2012 First things first: Rewrite Engine is ON The syntax(in the htaccess file): RewriteMap prologizontas txt:prologizontas.txt RewriteRule ^prologizontas-ton-eafto-mou${prologizontas:$1} And... the message in the error log i found in the cPanel: [Thu Feb 16 12:35:45 2012] [alert] [client 46.246.255.142] /home/hellenic/public_html/.htaccess: RewriteMap not allowed here The client address you see is...of course mine. public_html, is where all the site files are kept. What do you think?I think that this must be a directory problem, but what exactly, i cannot guess. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.