2
Contributors
7
Replies
38
Views
4 Years
Discussion Span
Last Post by LastMitch
0

how do I convert that to:

You can try this:

From this:

RewriteEngine On
RewriteRule ^mysite/(.*)/$ /mbs/index.php?view=$1 [L]

To this:

RewriteEngine On
RewriteRule ^mysite/([^/]*)\.php$ /mbs/index.php?view=$1 [L]

Edited by LastMitch: grammer

0

Sorry, still getting the 500 error :S

Read this:

http://pcsupport.about.com/od/findbyerrormessage/a/500servererror.htm

Was this an error before the Re Mod?

What else did you put in the htaccess file?

I think there might an issue with a code in htaccess file.

Did you touch anything like a # hash tag on the code?

I mean if the Re Mod is causing the issue then I think you need to rename to this:

RewriteRule ^mysite/(.*)/$ /index.php?view=$1 [L]

Think back what else you did before it was 500 error.

Then you will change it back and not do that again.

0

Take out line 4 to line 6

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]

That will solve the issue.

Leave line 1 and line 2 alone.

It seem like you want to redirect the old links to the new links then do this:

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-l
RewriteRule ^/(.*)$  /index.php?view=$1[L,QSA]  

Try to used an Index filename either it's index.php, index.html, index.htm not 1.php

Add this (it's a log in the future if you have an error like this it will tell you which line in the code is producing the error):

RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 5    

So this is how it should look like in the end:

RewriteEngine On
RewriteRule ^mysite/([^/]*)\.php$ /mbs/index.php?view=$1 [L]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-l
RewriteRule ^/(.*)$  /index.php?view=$1[L,QSA]  

RewriteLog /var/log/apache2/rewrite.log                                                                             
RewriteLogLevel 5

Edited by LastMitch: grammer

0

You will never guess what I just got:

Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.

Error 500

localhost
03/05/13 17:22:54
Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1

So, erm, yeah :/

I first typed in http://localhost/mysite/, then http://localhost/mysite/contact, the same error for both :S

1

Either the server is overloaded or there was an error in a CGI script.

Read this:

http://encodable.com/internal_server_error/

Try this for the Remod:

RewriteEngine On
RewriteRule ^mysite/([^/]*)\.php$ /mbs/index.php?view=$1 [L]
RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 5

If you didn't get any error then the error is here from your original code:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]

The code I provide didn't work either because the error still appears.

Then try this now:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?view=$1[QSA,L]

Mod_rewrite needs to be enabled on local host for htaccess to work.

Its an apache server that let htaccess file to run.

Edited by LastMitch: grammer

Votes + Comments
Thanks soooo much!!!! Worked perfectly!! :D
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.