Jump to content

[SOLVED] htaccess for url rewrite


jkewlo

Recommended Posts

Hey me again (dont run  ;D).

 

Well so I am trying to do a short url rewrite kinda like myspace. yoursite.com/username

 

so I know it has to be .htaccess so I.

ErrorDocument 404 /404.php
RewriteEngine on
Options +FollowSymlinks
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ /view.php?profile=$1 [L]

 

it is returning a internal server error, when trying to run it, which as we both know will pretty much shut the site down ><, any suggestions on what should be done?

Link to comment
https://forums.phpfreaks.com/topic/159361-solved-htaccess-for-url-rewrite/
Share on other sites

Wrong forum...

 

But try this

ErrorDocument 404 /404.php
Options +FollowSymlinks

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ view.php?profile=$1 [L]

 

The rewrite rule looks off to me. Which part do you want to get? new or Grind3r? Or both?

ErrorDocument 404 /404.php
Options +FollowSymlinks

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z]+)$ view.php?profile=$1 [L]

 

I'm not sure if the / would have caused anything. I would assume not. Try that one.

It's mod_rewrite.

 

One more try

ErrorDocument 404 /404.php
Options +FollowSymlinks

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ([a-zA-Z]+)$ view.php?profile=$1 [L]

 

Is it possible for you to print out what $_GET['profile'] is in view.php? That should help. Unless you're still getting 404s.

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.