Rewrite in short mode

This is a discussion on Rewrite in short mode within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi, i need to rewrite mysite.com/MyText in mysite.com/?page=MyText The real page is mysite.com/index....


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-23-2007
Scream
 
Posts: n/a
Default Rewrite in short mode

Hi, i need to rewrite mysite.com/MyText in mysite.com/?page=MyText

The real page is mysite.com/index.php?page=MyText but if I use only
?page= it function correctly.

My .htaccess is this

Options +FollowSymLinks +Indexes +MultiViews
RewriteEngine On
RewriteRule ^/([a-z]) ?page=$1 [L]
ErrorDocument 404 http://mysite/?page=Error
ErrorDocument 403 http://mysite/?page=Error
ErrorDocument 500 http://mysite/?page=Error
ErrorDocument 401 http://mysite/?page=Error

This code redirect all page in mysite.com/MyText form at
mysite/?page=Error. What's the solution? Another question (the last): if
I use ^/([a-z]) and the url is "mysite.com/My Text 2"...

Thanks,
Daniele
  #2 (permalink)  
Old 02-23-2007
Rik
 
Posts: n/a
Default Re: Rewrite in short mode

On Fri, 23 Feb 2007 02:34:39 +0100, Scream <danitag@infinito.it> wrote:

> Hi, i need to rewrite mysite.com/MyText in mysite.com/?page=MyText
>
> The real page is mysite.com/index.php?page=MyText but if I use only
> ?page= it function correctly.
>
> My .htaccess is this
>
> Options +FollowSymLinks +Indexes +MultiViews
> RewriteEngine On
> RewriteRule ^/([a-z]) ?page=$1 [L]
> ErrorDocument 404 http://mysite/?page=Error
> ErrorDocument 403 http://mysite/?page=Error
> ErrorDocument 500 http://mysite/?page=Error
> ErrorDocument 401 http://mysite/?page=Error
>
> This code redirect all page in mysite.com/MyText form at
> mysite/?page=Error. What's the solution?


Afaik, you cannot simply say ?etc...., in .htaccess, you must specifiy the
file.

> Another question (the last): if I use ^/([a-z]) and the url is
> "mysite.com/My Text 2"...


It will redirect to http://mysite/?page=M, because you only capture the
first character.

I'd:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php page=$1 [L]

--
Rik Wasmus
  #3 (permalink)  
Old 02-23-2007
Arjen
 
Posts: n/a
Default Re: Rewrite in short mode

Rik schreef:
> On Fri, 23 Feb 2007 02:34:39 +0100, Scream <danitag@infinito.it> wrote:
>
>> Hi, i need to rewrite mysite.com/MyText in mysite.com/?page=MyText
>>
>> The real page is mysite.com/index.php?page=MyText but if I use only
>> ?page= it function correctly.



A bit OT but I read somewhere yahoo or google wont index this. Cant
remember wich one it was and maybe it has changed but it seems a waste.

--
Arjen
http://www.hondenpage.com
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:07 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0