2008/12/31 6:58:17
|
---|
![]() |
site.com/content.php?page=XXX to site.com/XXXHello,
I want to change my site.com/content.php?page=XXX links to site.com/XXX , with using Rewriting Url. What is the code that i've to use to do that ! thank you |
2008/12/31 8:53:45
|
---|
|
Re: site.com/content.php?page=XXX to site.com/XXXyes this is the optimal rewrite engine, but at the moment not doable ...
maybe later with an impresscms node system. ![]() |
2008/12/31 9:26:33
|
---|
![]() |
Re: site.com/content.php?page=XXX to site.com/XXXwhy isn't it doable?
Shouldn't this work just fine?
RewriteRule ^content.php?page=XXX$ /XXX/ [R]
|
2008/12/31 9:51:18
|
---|
![]() |
Re: site.com/content.php?page=XXX to site.com/XXXIf you can use rewrite rules all you need is a little bit of hacking actually.
1. Check if the url is a valid url. If so then don't do anything. 2. If not a valid url: rewrite the url from site.com/XXX to site.com/content.php?page=XXX .htaccess code should be something like:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9_]*)$ content.php?page=$1 [NC,L]
This has not been tested yet but you can give it a try. On the following link you can find a few useful examples: http://httpd.apache.org/docs/1.3/misc/rewriteguide.html |
2008/12/31 9:56:11
|
---|
![]() |
Re: site.com/content.php?page=XXX to site.com/XXXI was just playing around with it - and its totally possble - this is actually working code. Modify to your needs.
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^content/([^/]+)$ /content.php?page=$1 [P,NC] You are going to need an identifier like /content/ or /page/ otherwise anything that comes after your domain is going to be forced into the loop. i.e. http://www.yoursite.com/modules... will become http://www.yoursite.com/content.php?page=modules... so if you use the "content" or "page" identifier it would prevent this. Edit: See Below |
2008/12/31 10:02:10
|
---|
![]() |
Re: site.com/content.php?page=XXX to site.com/XXXQuote:
Yes, logfically the procedure could be: 1. check if url exists, if true then don't rewrite the url 2. If url does not exist: use rewrite rule I have read on a site that #1 is done by:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
|
2008/12/31 10:06:22
|
---|
![]() |
Re: site.com/content.php?page=XXX to site.com/XXXmakes sense to me, and you are correct - so the final working code is
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)$ /content.php?page=$1 [P,NC] |
2008/12/31 11:26:32
|
---|
![]() |
Re: site.com/content.php?page=XXX to site.com/XXXExcellent, now the next step would be to generate SEO friendly links from the content manager itself. Meaning that all links in the content menu for example should be conforming the SEO friendly way. Preferrably this should be based on a variable configuration parameter.
Quick and dirty would be something like: If admin choses to use the rewrite rule in a .htaccess file, all url's to content pages should be rewritten from: site.com/content.php?page=XXX to site.com/XXX In order to do that we need to change the files: content.php modules/system/blocks/content_blocks.php include/functions.php In the first two files change the line: $content_subs['link'] = ICMS_URL.'/content.php?page='.$seo; to: $content_subs['link'] = ICMS_URL.'/'.$seo; In include/functions.php in function showNav() change the line: $url = ICMS_URL.'/content.php'; into: $url = ICMS_URL.'/' And the line: $ret = "<a href='".$url."?page=".$seo."'>".$cont->getVar('content_title')."</a>"; into: $ret = "<a href='".$url.$seo."'>".$cont->getVar('content_title')."</a>"; |
2008/12/31 11:46:00
|
---|
![]() |
Re: site.com/content.php?page=XXX to site.com/XXXvery cool - i did run into a little problem with accessing my domain if I didn't have anything trailing.
So mysite.com/ would redirect to the content manager and say "page does not exist - then send me to index.php A rule would need to be added for the toplevel. |
2008/12/31 15:42:54
|
---|
![]() |
Re: site.com/content.php?page=XXX to site.com/XXXYour Latest code MrTheme doesnt work, it give 404 error
|
2008/12/31 15:52:50
|
---|
![]() |
Re: site.com/content.php?page=XXX to site.com/XXXthis code works perfectly for me :
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^content/(.*)/$ /content.php?page=$1 [L]
RewriteRule ^content/(.*)$ /content.php?page=$1 [L]
|
2008/12/31 20:05:33
|
---|
![]() |
Re: site.com/content.php?page=XXX to site.com/XXXodd - works fine for me. perhaps Proxy Throughput is conflicting with something on your server.
Anywho, glad you got a solution that works for you. |
2009/1/1 3:01:21
|
---|
![]() |
Re: site.com/content.php?page=XXX to site.com/XXXThanks
![]() |
2009/1/1 7:53:15
|
---|
|
Re: site.com/content.php?page=XXX to site.com/XXXgreat tips, very helpful ... thank you.
![]() |
2009/2/3 9:39:58
|
---|
|
Re: site.com/content.php?page=XXX to site.com/XXXHello there!
the tips are really nice. I'm trying to apply this rewrite using my localhost and xampp 1.7 (php 5.28) and I'm not getting any response from localhost on the changes. I already checked over the loadmodule line under http.conf and uncommented it and restarted apache but I can't get it to run. Anyone has tips on how to go over this? Thanks Eyekeeper |
2009/2/12 9:17:01
|
---|
|
Re: site.com/content.php?page=XXX to site.com/XXXany ideas, plz?
|
2009/2/12 10:42:38
|
---|
![]() |
Re: site.com/content.php?page=XXX to site.com/XXXLoadModule auth_passthrough_module modules/mod_auth_passthrough.so
|
2009/2/13 7:38:24
|
---|
|
Re: site.com/content.php?page=XXX to site.com/XXXHello!
thanks for the reply I googled for this file but I can't get the "so" downloaded... I find it nowhere so I could test it... Do you know where to get it? Thanks once again |
2009/2/13 9:13:24
|
---|
![]() |
Re: site.com/content.php?page=XXX to site.com/XXXI am sorry - I copied the wrong line.
LoadModule rewrite_module modules/mod_rewrite.so is that the line that you uncommented? what apache version are you running? There may be a call to AddModule mod_rewrite.c as well that you would have to have uncommented. Then of course you need to make sure that the module is actually there. more info: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html Also did you make sure that htaccess was enabled? |
2009/2/14 6:50:42
|
---|
|
Re: site.com/content.php?page=XXX to site.com/XXXQuote:
no problem ;) Quote:
yes...this line was already uncommented Quote:
using Xampp I use following Apache HTTPD 2.2.11 + Openssl 0.9.8i MySQL 5.1.30 PHP 5.2.8 Quote:
there isn't this call as well All the rest should be fine... I don't know further |