0

this is my htaccess file:

Options +FollowSymlinks RewriteEngine on RewriteRule ^(.*) url.php?p=$1 [NC] 

Im trying to redirect like this: mysite.com/sometext to mysite.com/url.php?p=sometext

But with that file the browser gives me always an error; Internal Server Error, The server encountered an internal error or misconfiguration and was unable to complete your request.

2 Answers 2

1

Try adding some conditions to keep mod_rewrite from looping internally forever:

RewriteCond %{REQUEST_URI} !^/url.php 

Or:

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d 

Right before the RewriteRule

Sign up to request clarification or add additional context in comments.

Comments

0

The following should work. The "L" ensures that it will be last rewrite rule, which should prevent the loop.

RewriteRule ^/(.*)$ https://mysite.com/url.php?p=$1 [NC,R,L]

This one might work too (will need to try it out)

RewriteRule ^/(.*)$ url.php?p=$1 [NC,L]

1 Comment

The leading slash is stripped off when matching by apache when a RewriteRule is in .htaccess

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.