Jump to content

Help needed with PHP url rewrite, please.


gotit

Recommended Posts

I need to rewrite my url.
currently it reads like:

/system/listingView.php?listingCode=1029
/system/listingView.php?listingCode=1030
....
/system/listingView.php?listingCode=1050

Spiders might read them all as one page...

I prefere for the url to reflect some variables from the page like Listing_address and/or Listing_style

I have very limited knowledge of html

thanx
Link to comment
Share on other sites

What I want for my URL not to show as bellow.

[s][b]/system/listingView.php?listingCode=1029[/b][/s]

These pages are dynamically generated, so for every new page there is a new number at the end of URL, everything else looks the same.
If I can get the pages to show different, one from the other.

Look at my first post above for URLs readings.

thanx
Link to comment
Share on other sites

By the way, the page title code worked..........thanks for your help


I did that, i named my file .htaccess in notepad 
when i uploaded it with ftp, i see the extention then as .txt   so i deleted this extention there.

Is there another way of creating this file?

Link to comment
Share on other sites

[quote author=gotit link=topic=115271.msg469313#msg469313 date=1163726627]
By the way, the page title code worked..........thanks for your help


I did that, i named my file .htaccess in notepad 
when i uploaded it with ftp, i see the extention then as .txt  so i deleted this extention there.

Is there another way of creating this file?


[/quote]

The "other way" is specified above (I'm assuming you have CPanel access to a hosting account).

Windows [size=12pt][b]will not allow[/b] [/size]you to create a file named the way it needs to be named.

The file needs to be named [b].htaccess[/b]--period (with NOTHING before it) followed by htaccess.
Link to comment
Share on other sites

[quote author=doni49 link=topic=115271.msg469345#msg469345 date=1163730942]
[quote author=gotit link=topic=115271.msg469313#msg469313 date=1163726627]
By the way, the page title code worked..........thanks for your help


I did that, i named my file .htaccess in notepad 
when i uploaded it with ftp, i see the extention then as .txt  so i deleted this extention there.

Is there another way of creating this file?


[/quote]

The "other way" is specified above (I'm assuming you have CPanel access to a hosting account).

Windows [size=12pt][b]will not allow[/b] [/size]you to create a file named the way it needs to be named.

The file needs to be named [b].htaccess[/b]--period (with NOTHING before it) followed by htaccess.
[/quote]
I'm not sure I heard you correctly. I can go into notepad and save a file as .htaccess without any problem, and upload it and have it work. Why don't you try it?
Link to comment
Share on other sites

Windows [color=red][size=20pt][b]will not allow[/b] [/size][/color]you to create a file named the way it needs to be named.

A file [b]MUST[/b] have a file name--the extension (part AFTER the period is optional) but the portion before the period is [b]ABSOULUTELY[/b] required.
Link to comment
Share on other sites

[quote author=doni49 link=topic=115271.msg469356#msg469356 date=1163731582]
Windows [color=red][size=20pt][b]will not allow[/b] [/size][/color]you to create a file named the way it needs to be named.

A file [b]MUST[/b] have a file name--the extension (part AFTER the period is optional) but the portion before the period is [b]ABSOULUTELY[/b] required.

[/quote]
Would you like me to record a video of me doing exactly what you say is impossible?
Link to comment
Share on other sites

OK I digress.  You seemed so sure of yourself, I decided to try it.  This just goes against EVERYTHING I've ever experienced, read or been taught. 

In notepad's Save As dialog, where it asked for a filename, I typed ".htaccess" (WITH the quotes) and it saved the file.  I was even able to double click on it to open it.

One thing I can tell you with absolute certainty is that creating a new file (in Windows Explorer) and trying to name it that will not work (yes I tried after I saw this work).

EDIT:  Fixed typo.
Link to comment
Share on other sites

One thing I don't understand is:
when i creat the file past the code in it and then want to save as--- I simply past ".htaccess" in the file name with nothing following it.
and this file shows as .htaccess on my pc, but once I load it it shows as ".htaccess.txt" on the server. Does that has to do anything with it.

I also tried deleting that .txt on the server.

I do have access to hosting control panel, but there is no option for me to creat a file
these are the options categories:

1and1  is the host
Link to comment
Share on other sites

OK that one is easy to explain.  In windows you have "hide known extensions" turned on.  Notepad adds the txt extension to a filename if you name it something else.

i.e. if you use Save As and call it test.html, test.html.txt will be created.  But if you enclose the filename in quotes (double--" not single--'), it'll use what you supply as the whole name.  But this thing about STARTING the filename with a period is just FREAKY.
Link to comment
Share on other sites

[quote author=gotit link=topic=115271.msg469367#msg469367 date=1163732476]
One thing I don't understand is:
when i creat the file past the code in it and then want to save as--- I simply past ".htaccess" in the file name with nothing following it.
and this file shows as .htaccess on my pc, but once I load it it shows as ".htaccess.txt" on the server. Does that has to do anything with it.

I also tried deleting that .txt on the server.

I do have access to hosting control panel, but there is no option for me to creat a file
these are the options categories:

Domains
E-mail
WebMail
Websites & Applications
Web Space & Access
FTP Account
Quota
Marketing Center
Package Information
Software & Downloads
Order More Features
[/quote]

If they're that restrictive, they may very well have config'd their servers NOT to all the use of .htaccess files.  Who's your provider? 
Link to comment
Share on other sites

[quote author=LuckyBambu link=topic=115271.msg469385#msg469385 date=1163733909]
Got impatient, so I just uploaded it to Snapdrive. Everything else produced bad quality or took too long.
http://www.snapdrive.net/files/195519/Gee%20Wiz%20Htaccess.avi

This will both correct doni and hopefully help the opener of the thread.
[/quote]
Check page one, I already acknowledged that you were right.
Link to comment
Share on other sites

[quote author=doni49 link=topic=115271.msg469388#msg469388 date=1163734049]
[quote author=LuckyBambu link=topic=115271.msg469385#msg469385 date=1163733909]
Got impatient, so I just uploaded it to Snapdrive. Everything else produced bad quality or took too long.
http://www.snapdrive.net/files/195519/Gee%20Wiz%20Htaccess.avi

This will both correct doni and hopefully help the opener of the thread.
[/quote]
Check page one, I already acknowledged that you were right.
[/quote]
And this is why I should pay attention to edits. Sorry for not noticing, haha.
Link to comment
Share on other sites

[quote author=doni49 link=topic=115271.msg469380#msg469380 date=1163733161]
[quote author=gotit link=topic=115271.msg469367#msg469367 date=1163732476]
One thing I don't understand is:
when i creat the file past the code in it and then want to save as--- I simply past ".htaccess" in the file name with nothing following it.
and this file shows as .htaccess on my pc, but once I load it it shows as ".htaccess.txt" on the server. Does that has to do anything with it.

I also tried deleting that .txt on the server.

I do have access to hosting control panel, but there is no option for me to creat a file
these are the options categories:

Domains
E-mail
WebMail
Websites & Applications
Web Space & Access
FTP Account
Quota
Marketing Center
Package Information
Software & Downloads
Order More Features
[/quote]

If they're that restrictive, they may very well have config'd their servers NOT to all the use of .htaccess files.  Who's your provider? 
[/quote]

1and1 is the provider
Link to comment
Share on other sites

[quote author=doni49 link=topic=115271.msg469408#msg469408 date=1163736848]
and take a look here as well.

http://faq.1and1.com/scripting_languages_supported/configuring_apache_server_using_htaccess/4.html
[/quote]

This means we can use .htaccess in shared package. Does it? if yes why it's not working for me... :(

code used:

RewriteEngine On
Rewriterule ^system/listing([0-9]+).html$ /system/listingView.php?listingCode=$1
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.