Jump to content

Recommended Posts

can someone give me the regular expression to all A-B, a-b, 0-9 and !"£$%$%^ in my .htaccess file.

 

This is what i have so far, but it doesnt like any symbols such as ! or $ thanks.

 

Options -Indexes
RewriteEngine On


ErrorDocument 404 /errors/404page.html
RewriteRule ^([_\+A-Za-z0-9]+)?$ index.php?c=$1 

Link to comment
https://forums.phpfreaks.com/topic/139418-solved-someone-help-with-htaccess/
Share on other sites

Options -Indexes
RewriteEngine On
ErrorDocument 404 /errors/404page.html
RewriteRule ^([_\+A-Za-z0-9]+)?$ index.php?c=$1 
RewriteRule ^([_\+A-Za-z0-9]+\!)/([_\+A-Za-z0-9]+)?$ index.php?c=$1&title=$2  

 

the second rewrite rule is doing the following.

 

 

the c=$1 references to the case... so if it was

 

http://www.thedesignmonkeys.co.uk/fb  -----  that would be the case 'fb'

 

the next part is the title of the blog so....

 

http://www.thedesignmonkeys.co.uk/fb/this_is_blog_name!!

 

but for some reason it wont reconise the !! so it will give me a 404 error can someone help me rewrite my rules for them to be able to recosnise !!! or ...

 

 

thanks

 

 

Garry

URL's cannot contain spaces. You'll need to convert your spaces to dashes - or underscores _

 

For you're urls I would suggest you try to simplity them a bit, eg

 

ready-teddy-go

 

rather than

 

Ready, teddy, go ... into space!!

 

The aim of tidy urls is to keep them short and simple. I only allow the following chars A-Z (upper or lowercase) 0-9 and only the following symbols -_ making your rewrite rule

RewriteRule ^([A-Z0-9_-]+)/([A-Z0-9_-]+)/$ test.php?c=$1&title=$2   [NC,L]

NOTE: NC stands for case-insensitive.

i am doing a str replace on any spaces in the urls

 

so

 

 

Ready, teddy, go ... into space is

 

Ready,_teddy,_go_..._into_space!

 

it just doesnt like the ... or the !... is there nothing i can do to allow these urls??

 

 

Sorry I updated my post while you posted,

URL's cannot contain spaces. You'll need to convert your spaces to dashes - or underscores _

 

For you're urls I would suggest you try to simplity them a bit, eg

 

ready-teddy-go

 

rather than

 

Ready, teddy, go ... into space!!

 

The aim of tidy urls is to keep them short and simple. I only allow the following chars A-Z (upper or lowercase) 0-9 and only the following symbols -_ making your rewrite rule

RewriteRule ^([A-Z0-9_-]+)/([A-Z0-9_-]+)/$ index.php?c=$1&title=$2   [NC,L]

NOTE: NC stands for case-insensitive.

This is normally caused due to you not telling the web browser which charset to use for displaying fonts. To tell the browser which charset to use you can use the <meta> tag in your HTML eg

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

Your should also ensure you're using a valid DOCTYPE too.

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.