.htaccess with rewrite --> No WYSIWYG anymore !

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
Rupert
Posts: 31
Joined: Sun 27. Nov 2005, 00:59
Location: Frankfurt

.htaccess with rewrite --> No WYSIWYG anymore !

Post by Rupert »

Hello,
I moved from a html webpage to the CMS. Because I have a good Google Ranking, I used the "google friendly move" as described in the Documentation.

I changed the htaccess this way, that all html requests are redirected to my .php page. Works Great! No Problem with that.

BUT: I can't edit my old WYSIWYG Articles anymore. Everytime I cklick on "edit", I don't see the fckeditor with my article, instead I see my rendered webpage!
Same, when I'm trying to create a new WYSYWIG Article.
The "normal Text" (einfacher Text) Articles I can create and change without problems.

I didn't find anything in the forum regarding this problem. Perhaps, I'm the only person, with strange phpwcms problems .

PLEASE, I hope, somebody can help me!!!


This is my .htaccess:
# Check that you have set Options FollowSymLinks
# and right Allow
RewriteEngine On

# maybe you need this
DirectoryIndex index.php index.html


# Redirection of all .htm/html sides
RewriteRule ^(.*)\.htm$ http://www.katharina-m.net/index.php [r=301,nc]
RewriteRule ^(.*)\.html$ http://www.katharina-m.net/index.php [r=301,nc]
:?: :?:
User avatar
juergen
Moderator
Posts: 4556
Joined: Mon 10. Jan 2005, 18:10
Location: Weinheim
Contact:

Post by juergen »

Hello Rupert,

this is the wrong way round ;)

You should use the original rewrite rule from phpwcms for rewrite to ".phtml"

For old ".htm" you should use the "301" redirect to "....phtml"

From then on your system will not be confused anymore ;)

if you haye anything.htm: put in

Code: Select all

<?php
header("Status: 301 Moved Permanently");
header("Location:newadress.phtml");
exit;
?>
From then on your editors won't be confused anymore

Jürgen
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Post by marcus@localhorst »

I've had that problem, too.
It's very simple:
your htaccess code says
takeeach*.html and redirect it to index.php
you need to specifed your redirect code!

for a bigger project, I've redirected each single page, to the new cms url.
that is more save (it was about or more than 100 sites, but I have to recreate each of these older static pages into phpwcms, so it was not so much work, more, to include for each site a line of redirect code.

hope that helps
marcus

deutsch ist einfacher:
dein rewritecode sagt, das jede htm/html seite, die unter deiner domain zu finden ist, auf index.php umgeleitet wird.
der wysiwyg editor ist in wirklichkeit eine html seite in einen iframe geladen. da das eine html seite ist und der obrige code sagt...
den rest kannst du dir denken.
spezifiziere deinen redirect code etwas besser (ich weiss jetzt nicht ob man rewrite regeln zum ausperren von ordnern schreiben kann, sollte aber bestimmt gehen).
im notfalle erstelle für jede umzuleitende seite ein redirect
htaccess:

Code: Select all

Redirect 301 /news.php http://www.domain.de/news.phtml
hab ich auch gemacht für eine große seite.
da ich eh jede seite in phpwcms übernehmen musst, hab ich auch immer gleich für jede seite redirectcode geschrieben.

den standard phpwcms rewrite code sollte allerdings wirklich drin bleiben
htaccess:

Code: Select all

RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.phtml$ index.php?id=$1,$2,$3,$4,$5,$6
RewriteRule ^(.+)\.phtml$ index.php?$1
grüße
marcus
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Post by flip-flop »

Hi Rupert,

if you are working with the FCK you can´t redirect HTML using this method. FCK consists of .html files.
But this should work:

Code: Select all

RewriteRule ^(.*)\.htm$ http://www.katharina-m.net [r=301,nc]


Please apply the abovementioned method.

Gruß Knut
Last edited by flip-flop on Mon 19. Jun 2006, 22:04, edited 1 time in total.
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
Rupert
Posts: 31
Joined: Sun 27. Nov 2005, 00:59
Location: Frankfurt

Post by Rupert »

Hello Thank you for your answers!

NOW, "The Groschen is fallen!"
I put this in my .htaccess (beside the standard original stuff). And it works! THANK YOU for your help !!! I'm really happy now.
# REDIRECTS DER ALTEN SEITEN
Redirect 301 index.html http://katharina-m.net/index.php
#DEUTSCH
Redirect 301 /deutsch/index.html http://katharina-m.net/index.php?de
Redirect 301 /deutsch/boutique.html http://katharina-m.net/index.php?de_boutique
Redirect 301 /deutsch/contact.html http://katharina-m.net/index.php?de_kontakt
Redirect 301 /deutsch/huete.html http://katharina-m.net/index.php?de_huete
Redirect 301 /deutsch/impressum.html http://katharina-m.net/index.php?impressum
Redirect 301 /deutsch/kuenstler.html http://katharina-m.net/index.php?de_kuenstlerin
Redirect 301 /deutsch/links.html http://katharina-m.net/index.php?de_links

#ESPANOL
Redirect 301 /espanol/index.html http://katharina-m.net/index.php?es
Redirect 301 /espanol/artista.html http://katharina-m.net/index.php?es_kuenstlerin
Redirect 301 /espanol/contacto.html http://katharina-m.net/index.php?es_kontakt
Redirect 301 /espanol/sombreros.html http://katharina-m.net/index.php?es_huete
Redirect 301 /espanol/boutique.html http://katharina-m.net/index.php?es_boutique
Redirect 301 /espanol/impressum.html http://katharina-m.net/index.php?impressum
Redirect 301 /espanol/links.html http://katharina-m.net/index.php?es_links

#ENGLISH
Redirect 301 /english/index.html http://katharina-m.net/index.php?uk
Redirect 301 /english/artist.html http://katharina-m.net/index.php?uk_kuenstlerin
Redirect 301 /english/contact.html http://katharina-m.net/index.php?uk_kontakt
Redirect 301 /english/hats.html http://katharina-m.net/index.php?uk_huete
Redirect 301 /english/boutique.html http://katharina-m.net/index.php?uk_boutique
Redirect 301 /english/impressum.html http://katharina-m.net/index.php?impressum
Redirect 301 /english/links.html http://katharina-m.net/index.php?uk_links

#FRANCAIS
Redirect 301 /francais/index.html http://katharina-m.net/index.php?fr
Redirect 301 /francais/artiste.html http://katharina-m.net/index.php?fr_kuenstlerin
Redirect 301 /francais/contact.html http://katharina-m.net/index.php?fr_kontakt
Redirect 301 /francais/chapeaux.html http://katharina-m.net/index.php?fr_huete
Redirect 301 /francais/boutique.html http://katharina-m.net/index.php?fr_boutique
Redirect 301 /francais/impressum.html http://katharina-m.net/index.php?impressum
Redirect 301 /francais/liens.html http://katharina-m.net/index.php?fr_links
PROBLEM with the .phtml
When I use the original .htaccess, I get an 500 internal server error, when this two lines are activated:
#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
... and it seems, that the rewrite is not working with the original .htaccess (there is no rewrite to .phtml).

But, thats not so important, because the others redirects are working with your help.

Thank you for your answers and your help again! That is great, that I find help here so fast!
Last edited by Rupert on Mon 19. Jun 2006, 22:38, edited 1 time in total.
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Post by flip-flop »

1.Yes. If you do so, please don´t use an htm/html redirect at your .htaccess.

2. Please dont´t activate

Code: Select all

#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
Use this:

Code: Select all

RewriteEngine On

# maybe you need this
#DirectoryIndex index.html index.php 


# Default ReWrite settings for phpwcms
# ===============================================
# This will rewrite 0.0.0.0.0.0.phtml => index.php?id=0.0.0.0.0.0
RewriteBase /
RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.phtml$ index.php?id=$1,$2,$3,$4,$5,$6

# This will rewrite mypage.phtml => index.php?mypage
RewriteRule ^(.+)\.phtml$ index.php?$1
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Post by marcus@localhorst »

Rupert wrote: 1. I have about 30 HTML pages, not too much. Can I forget all the rewrite staff, when I put in every html page this code:
<?php
header("Status: 301 Moved Permanently");
header("Location:http://katharina-m.net/index.php");
exit;
?>
2...
... and it seems, that the rewrite is not working with the original .htaccess (there is no rewrite to .phtml).
1. ?! php code in *.html sites? if you don't setup your server/account, to parse all htm(l) sites throught php, nothing will happen!
use the htaccess file and 30 lines of redirect code, it is the simplest solution.

point 2...
put the orginal rewrite code back to the htaccess and look in config.php to turn on phpwcms rewrite settings. then it should work.
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Post by flip-flop »

You are right. Probably he can´t adjust the server. :oops:
Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
Rupert
Posts: 31
Joined: Sun 27. Nov 2005, 00:59
Location: Frankfurt

Post by Rupert »

... I edited my original post but you are so fast and helpful, your answer was faster than my edit :-)

I have now this in my .htaccess (besides the whole stuff above with the redirects).
# These settings are recommend
# Maybe you might have problems
# with other scripts that needs
# register_globals ON

# Rewrite functionality for phpwcms
# optimized by Jan212
# 18-04-2004

# Check that you have set Options FollowSymLinks
# and right Allow
RewriteEngine On

# maybe you need this
DirectoryIndex index.php index.html

# Default ReWrite settings for phpwcms
# ===============================================
# This will rewrite 0.0.0.0.0.0.phtml => index.php?id=0.0.0.0.0.0
RewriteBase /
RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.phtml$ index.php?id=$1,$2,$3,$4,$5,$6

# This will rewrite mypage.phtml => index.php?mypage
RewriteRule ^(.+)\.phtml$ index.php?$1
But I can't see, that it is working. Or another question, how can I see, that it is working.
I understand, that all my pages (like this one: http://katharina-m.net/index.php?id=28,37,1,1,1,0) is written to a new site? But which one?
I have the feeling, "I'm standing on the tube".
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Post by flip-flop »

conf.inc.php:
$phpwcms["rewrite_url"] = 1; //whether URL should be rewritable :?:
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
Rupert
Posts: 31
Joined: Sun 27. Nov 2005, 00:59
Location: Frankfurt

Post by Rupert »

yes, I have put it to 1:
// other stuff
$phpwcms["compress_page"] = 0; //0 = OFF, 1-9: page compression ON (1 = low level, 9 = highest level)
$phpwcms["imagick"] = 0; //0 = GD, 1 = ImageMagick, 2 = ImageMagick 4.2.9
$phpwcms["imagick_path"] = ""; //Path to ImageMagick (default="" - none)
$phpwcms["use_gd2"] = 1; //0 = GD1, 1 = GD2
$phpwcms["rewrite_url"] = 1; //whether URL should be rewritable
$phpwcms["wysiwyg_editor"] = 2; //0 = no wysiwyg editor, 1 = HTMLarea, 2 = FCKeditor, 3 = browser based
$phpwcms["phpmyadmin"] = 0; //enable/disable phpMyAdmin in Backend
$phpwcms["default_lang"] = "fr"; //default language
$phpwcms["charset"] = "UTF-8"; //default charset 'iso-8859-1'
$phpwcms["allow_remote_URL"] = 0; //0 = no remote URL in {PHP:...} replacement tag allowed, 1 = allowed
$phpwcms["gt_mod"] = 1; //0 = Graphical Text MOD disabled, 1 = enabled
$phpwcms["jpg_quality"] = 75; //JPG Quality Range 25-100
$phpwcms["sharpen_level"] = 1; //Sharpen Level - only ImageMagick: 0, 1, 2, 3, 4, 5 -- 0 = no, 5 = extra sharp
$phpwcms["allow_ext_init"] = 1; //allow including of custom external scripts at frontend initialization
$phpwcms["allow_ext_render"] = 1; //allow including of custom external scripts at frontend rendering
$phpwcms["cache_enabled"] = 0; //cache On/Off - 1 = caching On / 0 = caching Off (default)
$phpwcms["cache_timeout"] = 0; //default cache timeout setting in seconds - 0 = caching Off
$phpwcms["imgext_disabled"] = ''; //comma seperated list of imagetypes which should not be handled "pdf,ps"
$phpwcms["multimedia_ext"] = 'aif,aiff,mov,movie,mp3,mpeg,mpeg4,mpeg2,wav,swf,swc,ram,ra,wma,wmv,avi,au,midi,moov,rm,rpm,mid,midi'; //comma seperated list of file extensiosn allowed for multimedia
$phpwcms["inline_download"] = 1; //1 = try to display download documents in new window; 0 = show safe under dialog
$phpwcms["form_tracking"] = 1; //make a db entry for each form
$phpwcms["formmailer_set"] = array('allow_send_copy' => 0, 'global_recipient_email' => 'form@localhost'); //for better security handling
$phpwcms["allow_cntPHP_rt"] = 0; //allow PHP replacement tags and includes in content parts
User avatar
juergen
Moderator
Posts: 4556
Joined: Mon 10. Jan 2005, 18:10
Location: Weinheim
Contact:

Post by juergen »

Hier werden Sie "zerholfen" :o

Ask your provider to put the "FollowSymLinks" Flag on for your account.

This has to be done in Apache config. This prevents the Server Error 500. And this symbolic link (!) to phtml is VERY helpfull for Search engine.
NTB
Posts: 11
Joined: Sat 17. Dec 2005, 15:54

Post by NTB »

I rewrote my phpwcms to not show .phtml but to show .html for all links. Therefore I had the same problem: the fckeditor wouldn't show anymore. That's because, as already mentioned, it's an .html and loaded in an iframe. Since the editor, and all other kind of little helpers, are in the directory "include", I just excluded it with a simple line in .htaccess somewhere at the beginning before the other rules. It's probably not the nicest way, since there probably is an other way to exclude, but it works:

Code: Select all

RewriteRule (.*)include/(.*) $1include/$2 [L]

# Default ReWrite settings for phpwcms
# ===============================================
# This will rewrite 0.0.0.0.0.0.html => index.php?id=0.0.0.0.0.0
RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.html$ index.php?id=$1,$2,$3,$4,$5,$6

# This will rewrite mypage.html => index.php?mypage
RewriteRule ^(.+)\.html$ index.php?$1

"*include*/" is rewritten to "*include/*", which of course is senseless, but the processor stops because of the [L] and won't process the rule for rewriting to index.php, which should come after this line.
Post Reply