Jump to content

[SOLVED] Short URLs on Local Apache Server?


GravityFX

Recommended Posts

Hello, I've installed "XAMPP" http://www.apachefriends.org/en/xampp.html

 

I am trying to create short url based on my old file:

This code works just fine on my internet site:

RewriteEngine on   
RewriteRule ^([^\.]+)$ index.php?p=$1 [L]

 

I am using http://localhost/index.php?p=news right now, how can I mod_rewrite on my local server, so it will work right, http://localhost/news

 

Link to comment
Share on other sites

Yes, I do! I get this error:

 

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

Link to comment
Share on other sites

ok thanks ;-) Solved the problem!

 

If you are using XAMPP too, you can follow this steps:

 

1st. I've edited file "httpd.conf" in "xampp\apache\conf" directory.

 

All you due is un-comment line #118

 

From:

#LoadModule rewrite_module modules/mod_rewrite.so

 

To:

LoadModule rewrite_module modules/mod_rewrite.so

 

Then restart your XAMPP apache server.

 

 

2nd. Write .htaccess file:

 

# short urls
RewriteEngine on   
RewriteRule ^([^\.]+)$ index.php?p=$1 [L]

 

This will make my urls short.

 

Long url: http://localhost/index.php?p=news

 

Short url: http://localhost/news

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.