GetSimple Support Forum

Full Version: Rewrite for a single page url?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I would like to make a 301 redirection via .htaccess file for one single page.

My rewrite rules at the moment are:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine on

    # Usually RewriteBase is just '/', but
    # replace it with your subdirectory path
    # RewriteBase /getsimple/
     RewriteBase /

    # Rewrite www
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    
    # without .html
    RewriteRule ^(.*)\.html$ $1 [R=301,L]
    
    RewriteRule ^folder/oldpagename http://www.domainname.de/folder/newpagename [R=301,L] # how??
    RewriteRule ^oldfolder http://www.domainname.de/newfolder [R=301,L]
    RewriteRule ^blog/tag/?$ /blog [R=301,L]
    RewriteRule ^blog/post/?$ blog [R=301,L]
    
    # News Manager:
    RewriteRule ^blog/tag/([^/.]+)/page/([^/.]+)/?$ index.php?id=blog&tag=$1&page=$2 [L]
    RewriteRule ^blog/tag/([^/.]+)/?$ index.php?id=blog&tag=$1 [L]
    RewriteRule ^blog/post/([^/.]+)/?$ index.php?id=blog&post=$1 [L]
    RewriteRule ^blog/page/([^/.]+)/?$ index.php?id=blog&page=$1 [L]
    RewriteRule ^blog/archive/([^/.]+)/?$ index.php?id=blog&archive=$1 [L]
    # end News Manager
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]
    

    RewriteRule ^data/uploads/(.*)$ plugins/download_interceptor/intercept.php?file=$1 [L]
    
</IfModule>

But the line with ...oldpagename ...newpagename does not work. What am I doing wrong?

The other redirections are for urls without .html and for urls always with www and other stuff.

Bye
Hypertexter


Wow, seems to work with:


Code:
RewriteRule ^blog/post/oldpagename/?$ $1/blog/post/newpagename [R=301,L]

Angel
But it was trial and error - with a phase of a frozen Firefox or server, where no redirection worked any more, very funny.

Does anybody know a good introduction into the syntax of .htaccess for beginners? I just found a lot of "do this" without further explanations.
Better is find .htaccess tutorials on internet as .htaccess tutorials are some thing else compared to get simple cms. Here is a tutorial though

https://www.addedbytes.com/articles/for-...beginners/
There are some rules scattered about the forums, try searching for htaccess redirects and stuff.

Or just wait and someone will eventually post something useful.
@all:

Thank you for your answers. At the moment I am happy with the solution from my first post, but when the next difficulties occur, I will try the plugin - and read the article for beginners: it seems to be more detailed than those I knew before!

Thank you
Hypertexter
Note that the Redirect plugin only works for pages, NOT for posts (News Manager, GS Blog...)
(2015-10-20, 04:29:01)Carlos Wrote: [ -> ]Note that the Redirect plugin only works for pages, NOT for posts (News Manager, GS Blog...)

Aha! This could have the same reason like why my standard rewrite entries did not work for blog post pages...
No, it's just that the Redirect plugin was made for normal pages.
Find the .htaccess programming code on the internet. Is the best way to redirection via .htaccess file.
https://gist.github.com/ScottPhillips/1721489