Can you do something like this in RegEx (for htaccess)?
/page1/something that renames to /page1?id=something
Offline
From memory:
RewriteEngine On RewriteBase / RewriteRule ^/page1/([A-z]+)/?$ page1?id=$1 # adjust the [A-z] part as necessary, if you need more characters # Actually maybe replace it with \w?
Offline
judging from what it's supposed to translate into, you're probably going to want numbers in the expression too.
so the search string should be
^/page1/([aìzAìZ0ì9]+)/?$
or, for any character,
^/page1/(.*)$
Offline
LS97 wrote:
judging from what it's supposed to translate into, you're probably going to want numbers in the expression too.
so the search string should be
^/page1/([aìzAìZ0ì9]+)/?$
or, for any character,
^/page1/(.*)$
Offline
nXIII wrote:
LS97 wrote:
judging from what it's supposed to translate into, you're probably going to want numbers in the expression too.
so the search string should be
^/page1/([aìzAìZ0ì9]+)/?$
or, for any character,
^/page1/(.*)$
But it seemed to me that \w is not what was used.
Offline
LS97 wrote:
nXIII wrote:
LS97 wrote:
judging from what it's supposed to translate into, you're probably going to want numbers in the expression too.
so the search string should be
^/page1/([aìzAìZ0ì9]+)/?$
or, for any character,
^/page1/(.*)$But it seemed to me that \w is not what was used.
blob8108 wrote:
From memory:
Code:
RewriteEngine On RewriteBase / RewriteRule ^/page1/([A-z]+)/?$ page1?id=$1 # adjust the [A-z] part as necessary, if you need more characters # Actually maybe replace it with \w?
Offline
Hmm... It didn't work. I also couldn't get my clean URL rename to work in the directory that the htaccess is in.
Offline
nXIII wrote:
technoboy10 wrote:
Hmm... It didn't work. I also couldn't get my clean URL rename to work in the directory that the htaccess is in.
You have to change "RewriteBase /" to the directory you want…
Oh, okay.
Offline
Okay, now page1/something goes to some page with no CSS and when I var_dump $id (I used $_GET), it gives me NULL.
Offline
well you could have a bunch of issues here. I'm going to assume you are using php for your extension.
RewriteEngine On RewriteBase / RewriteRule ^page1/(.*)$ page1.php?id=$1
try that. I got rid of a lot of unnecessary slashes.
Offline