[Solved] .htaccess help needed

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
neodare
Forum Newbie
Posts: 4
Joined: Fri Apr 16, 2010 2:09 am

[Solved] .htaccess help needed

Post by neodare »

this is my requirement ..

Instead of:
http://www.domianname.com/beta/showplay ... est-shaggy

We should have:
http://www.domianname.com/beta/channel/test-shaggy

here wat i need is a .htacess file and it should be inserted into the beta folder .

and here is the .htacess content

RewriteEngine On
RewriteRule ^channel/(.*)$ showplayer.php?n=$1 [L]

when i checked http://www.domianname.com/beta/channel/1222 or http://www.domianname.com/beta/channel/1222/

it doesnt work and i got 500 error ..it means .htacess work bt the url related is wrong ..i hope some help me fast as they can..

can anyone please post me the correct .htaccess format ..

thanks in advance ......
Last edited by neodare on Fri Apr 16, 2010 11:08 pm, edited 1 time in total.
mrcoffee
Forum Commoner
Posts: 31
Joined: Tue Nov 10, 2009 3:03 pm
Location: Wyoming, USA

Re: .htaccess help needed

Post by mrcoffee »

The two lines you provided look correct for what you're wanting to do, I think the issue is with something else.

Have you used mod_rewrite on this server before? If not, perhaps the module is not loaded.

Maybe also try adding "Options +FollowSymLinks" on the first line (in case it's not enabled at the root level, it needs to be on for mod_rewrite to work - although I don't think it would cause a 500 error).

Good luck.
neodare
Forum Newbie
Posts: 4
Joined: Fri Apr 16, 2010 2:09 am

Re: .htaccess help needed

Post by neodare »

i tried this way also

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^channel/(.*)$ showplayer.php?n=$1 [L]


still it remains the same .....


and i cant even call the direct file showplayer.php

http://www.domianname.com/beta/showplay ... est-shaggy


...it also shows 500 error ....... why so ..


i tried this on three servers and the same happend ....

one more doubts how to check this on localhost .im using wamp server and i checked the httpd conf file and its enabled there and when i cheked php info code it shows mod_rewrite enabled ....bt it doesnt work in loaclhost too...
mrcoffee
Forum Commoner
Posts: 31
Joined: Tue Nov 10, 2009 3:03 pm
Location: Wyoming, USA

Re: .htaccess help needed

Post by mrcoffee »

If there's a problem with .htaccess you'll get a 500 error for any request in the same directory and any sub-directories.

I did test the following on my server:
[text]RewriteEngine On
RewriteRule ^channel/(.*)$ showplayer.php?n=$1 [L][/text] and it did what you're looking for it to do, so the syntax of that portion is fine.

I'm wondering, for the sake of troubleshooting, what happens if you enter only the following line (or something similar) in the .htaccess file:
[text]Redirect /beta/ http://www.google.com/[/text]
Trying to access http://www.domainname.com/beta/something should then redirect to http://www.google.com/something, but if you get a 500 error with this too that would help determine where to look next. Also, if you do get an error with this, what about with a blank .htaccess file? And what then if you remove the file? Perhaps the file is corrupted or contains an invalid character or line ending, or if you still get the error without the file then we know the problem is with a parent setting.

Server administration is not my strongest area, so hopefully someone else reading might have a better idea of what's happening.
neodare
Forum Newbie
Posts: 4
Joined: Fri Apr 16, 2010 2:09 am

.htaccess solved

Post by neodare »

the problem is solved ..thanks for all ur support ..the problem was with my .htacess file ...i actaully edited the file with notepad++ and it has bug which insert a asci key when we click enter ...and that canbt be seen it notepad++ ...when the checked the .htacess file with notepad (windows default) i got this and i corrected the .htacess and it worked ....

once again ..sorry for the trouble i knows its my mistake :banghead: :banghead: ....... thanks again for all ur support . :D :D ...
Post Reply