Jump to content

htaccess Problem: Pretty URL with ~username and ip - Please Help!


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 with original url if it is not made pretty with htaccess code.  What server setting should be changed or is it the code?  The php server is 5.9

 

Thanks

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

 

Should work, im not a expert with htaccess but i have similar entries in my htaccess.

 

Heres one of mine. Which comes up as domain.com/generators/somegame

 

RewriteRule ^generators\/(.*) gen.php?game=$1 [NC]

I figured that if I give .php extension to the file name, the htaccess, the my code and the code you sent works.

But my problem remains as I am looking for clean url without .php.

 

eg: <a href='http://00.00.00.000/~sitename/test.php/$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 ^test.php/(.*)\$ test.php?id=$1 [QSA,L]

</IfModule>

I figured that if I give .php extension to the file name, the htaccess, the my code and the code you sent works.

But my problem remains as I am looking for clean url without .php.

 

eg: <a href='http://00.00.00.000/~sitename/test.php/$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 ^test.php/(.*)\$ test.php?id=$1 [QSA,L]

</IfModule>

 

^test.php/(.*)\$ is what you turn test.php into.. so why would you add .php to that part if you dont want it in the url.. im kinda lost now lol

Yes, you're right.  My goal is to have clean url with no php extension.

 

I am migrating to a new server and the new server is not recognising the previous htaccess code I have been using(posted in my first posting) which did display clean url.  But now, I am unable to figure out why the server does not recognize the masking of test.php

 

I am not getting help from my hosting company as they it is a coding issue. 

 

The server is on php 5.9.  Is there any insight on why server does not recognize the htaccess masking without the .php extension? Or am I coding wrong?

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.