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
https://forums.phpfreaks.com/topic/64584-solved-short-urls-on-local-apache-server/
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

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.