Jump to content

htaccess not working with ~username URL. Please HELP!


DingDong

Recommended Posts

I am uable to pass query string variables through pretty URL in my test site which has the ip with tilda username URL (example: http://00.00.00.000/~sitename/testpage/$id). Can it be due to server settings, or the tilda in the URL? Execution gives me a 404 error.

 

The url is displayed on the page as

<a href='http://00.00.00.000/~sitename/testpage/$id'>".$title."</a>

 

The htaccess file is:

 

<IfModule mod_rewrite.c>

Options +Indexes

Options +FollowSymlinks

    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d

#  RewriteCond %{REQUEST_FILENAME} !-f

#  RewriteRule ^testitemnews/(.*)\$ test.php?id=$1 [QSA,L]

</IfModule>

I also tried the rewrite rule with

 

#  RewriteRule ^http://00.00.00.000/~sitename/testitemnews/(.*)\$ http://00.00.00.000/~sitename/testpage.php&id=$1 [QSA,L]

 

Why is the page not displaying? I am really in a bad situation.  Please help.

The page displays if the url is not pretty with no htaccess code.  What server setting should be changed or is it the code?  The php server is 5.9

 

Thanks

Link to comment
Share on other sites

The first part of a RewriteRule matches against the REQUEST_URI, not the full path so the second example is definitely incorrect. As for your first example, this would assume that the .htaccess file is in the /~sitename/ folder. I'm also not clear on why you have the forward slash before the dollar. My best guess at what you're after is...

 

RewriteRule ^testitemnews/(.*)$ /~sitename/test.php?id=$1 [QSA,L] 

 

Link to comment
Share on other sites

I removed the slash and tried the code.  It is still giving me 404 error. 

 

My code was working perfectly fine in a shared server and I want to migrate to different one.  This hosting company says if I add extension to the file, it works. 

 

eg: RewriteRule ^test.php/(.*)$ test.php?id=$1 [QSA,L]

 

It does work.  But I want clean url and they are unable to help me as I do not what server setting is wrong or to be turned on.  Any help?

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.